@@ -60,8 +60,8 @@ describe('DHT subsystem operates correctly', () => {
60
60
expect ( connection ) . to . exist ( )
61
61
62
62
return Promise . all ( [
63
- pWaitFor ( ( ) => libp2p . _dht . routingTable . size === 1 ) ,
64
- pWaitFor ( ( ) => remoteLibp2p . _dht . routingTable . size === 1 )
63
+ pWaitFor ( ( ) => libp2p . _dht . _lan . _routingTable . size === 1 ) ,
64
+ pWaitFor ( ( ) => remoteLibp2p . _dht . _lan . _routingTable . size === 1 )
65
65
] )
66
66
} )
67
67
@@ -71,14 +71,14 @@ describe('DHT subsystem operates correctly', () => {
71
71
72
72
await libp2p . dialProtocol ( remAddr , subsystemMulticodecs )
73
73
await Promise . all ( [
74
- pWaitFor ( ( ) => libp2p . _dht . routingTable . size === 1 ) ,
75
- pWaitFor ( ( ) => remoteLibp2p . _dht . routingTable . size === 1 )
74
+ pWaitFor ( ( ) => libp2p . _dht . _lan . _routingTable . size === 1 ) ,
75
+ pWaitFor ( ( ) => remoteLibp2p . _dht . _lan . _routingTable . size === 1 )
76
76
] )
77
77
78
78
await libp2p . contentRouting . put ( key , value )
79
- const fetchedValue = await remoteLibp2p . contentRouting . get ( key )
80
79
81
- expect ( fetchedValue ) . to . eql ( value )
80
+ const fetchedValue = await remoteLibp2p . contentRouting . get ( key )
81
+ expect ( fetchedValue ) . to . have . property ( 'val' ) . that . equalBytes ( value )
82
82
} )
83
83
} )
84
84
@@ -119,11 +119,13 @@ describe('DHT subsystem operates correctly', () => {
119
119
const connection = await libp2p . dial ( remAddr )
120
120
121
121
expect ( connection ) . to . exist ( )
122
- expect ( libp2p . _dht . routingTable . size ) . to . be . eql ( 0 )
123
- expect ( remoteLibp2p . _dht . routingTable . size ) . to . be . eql ( 0 )
122
+ expect ( libp2p . _dht . _lan . _routingTable . size ) . to . be . eql ( 0 )
124
123
125
124
await remoteLibp2p . _dht . start ( )
126
- return pWaitFor ( ( ) => libp2p . _dht . routingTable . size === 1 )
125
+ // should be 0 directly after start - TODO this may be susceptible to timing bugs, we should have
126
+ // the ability to report stats on the DHT routing table instead of reaching into it's heart like this
127
+ expect ( remoteLibp2p . _dht . _lan . _routingTable . size ) . to . be . eql ( 0 )
128
+ return pWaitFor ( ( ) => libp2p . _dht . _lan . _routingTable . size === 1 )
127
129
} )
128
130
129
131
it ( 'should put on a peer and get from the other' , async ( ) => {
@@ -133,12 +135,12 @@ describe('DHT subsystem operates correctly', () => {
133
135
const value = uint8ArrayFromString ( 'world' )
134
136
135
137
await remoteLibp2p . _dht . start ( )
136
- await pWaitFor ( ( ) => libp2p . _dht . routingTable . size === 1 )
138
+ await pWaitFor ( ( ) => libp2p . _dht . _lan . _routingTable . size === 1 )
137
139
138
140
await libp2p . contentRouting . put ( key , value )
139
141
140
142
const fetchedValue = await remoteLibp2p . contentRouting . get ( key )
141
- expect ( fetchedValue ) . to . eql ( value )
143
+ expect ( fetchedValue ) . to . have . property ( 'val' ) . that . equalBytes ( value )
142
144
} )
143
145
} )
144
146
} )
0 commit comments