@@ -78,7 +78,7 @@ describe('network', () => {
7878
7979 it ( 'connectTo fail' , async ( ) => {
8080 try {
81- await networkA . connectTo ( p2pB . peerInfo . id )
81+ await networkA . connectTo ( p2pB . peerId )
8282 chai . assert . fail ( )
8383 } catch ( err ) {
8484 expect ( err ) . to . exist ( )
@@ -89,24 +89,26 @@ describe('network', () => {
8989 var counter = 0
9090
9191 bitswapMockA . _onPeerConnected = ( peerId ) => {
92- expect ( peerId . toB58String ( ) ) . to . equal ( p2pB . peerInfo . id . toB58String ( ) )
92+ expect ( peerId . toB58String ( ) ) . to . equal ( p2pB . peerId . toB58String ( ) )
9393 counter ++
9494 }
9595
9696 bitswapMockB . _onPeerConnected = ( peerId ) => {
97- expect ( peerId . toB58String ( ) ) . to . equal ( p2pA . peerInfo . id . toB58String ( ) )
97+ expect ( peerId . toB58String ( ) ) . to . equal ( p2pA . peerId . toB58String ( ) )
9898 counter ++
9999 }
100100
101- await p2pA . dial ( p2pB . peerInfo )
101+ p2pA . peerStore . addressBook . set ( p2pB . peerId , p2pB . multiaddrs )
102+ await p2pA . dial ( p2pB . peerId )
102103
103104 await pWaitFor ( ( ) => counter >= 2 )
104105 bitswapMockA . _onPeerConnected = ( ) => { }
105106 bitswapMockB . _onPeerConnected = ( ) => { }
106107 } )
107108
108109 it ( 'connectTo success' , async ( ) => {
109- await networkA . connectTo ( p2pB . peerInfo )
110+ p2pA . peerStore . addressBook . set ( p2pB . peerId , p2pB . multiaddrs )
111+ await networkA . connectTo ( p2pB . peerId )
110112 } )
111113
112114 const versions = [ {
@@ -136,7 +138,8 @@ describe('network', () => {
136138
137139 bitswapMockB . _receiveError = ( err ) => deferred . reject ( err )
138140
139- const { stream } = await p2pA . dialProtocol ( p2pB . peerInfo , '/ipfs/bitswap/' + version . num )
141+ // TODO: set addr
142+ const { stream } = await p2pA . dialProtocol ( p2pB . peerId , '/ipfs/bitswap/' + version . num )
140143 await pipe (
141144 [ version . serialize ( msg ) ] ,
142145 lp . encode ( ) ,
@@ -167,11 +170,12 @@ describe('network', () => {
167170
168171 bitswapMockB . _receiveError = deferred . reject
169172
170- await networkA . sendMessage ( p2pB . peerInfo . id , msg )
173+ await networkA . sendMessage ( p2pB . peerId , msg )
171174 } )
172175
173176 it ( 'dial to peer on Bitswap 1.0.0' , async ( ) => {
174- const { protocol } = await p2pA . dialProtocol ( p2pC . peerInfo , [ '/ipfs/bitswap/1.1.0' , '/ipfs/bitswap/1.0.0' ] )
177+ p2pA . peerStore . addressBook . set ( p2pC . peerId , p2pC . multiaddrs )
178+ const { protocol } = await p2pA . dialProtocol ( p2pC . peerId , [ '/ipfs/bitswap/1.1.0' , '/ipfs/bitswap/1.0.0' ] )
175179
176180 expect ( protocol ) . to . equal ( '/ipfs/bitswap/1.0.0' )
177181 } )
@@ -196,7 +200,7 @@ describe('network', () => {
196200
197201 bitswapMockC . _receiveError = deferred . reject
198202
199- await networkA . sendMessage ( p2pC . peerInfo . id , msg )
203+ await networkA . sendMessage ( p2pC . peerId , msg )
200204 await deferred . promise
201205 } )
202206} )
0 commit comments