@@ -111,15 +111,17 @@ describe('DelegatedPeerRouting', function () {
111
111
describe ( 'findPeers' , ( ) => {
112
112
it ( 'should be able to find peers via the delegate with a peer id string' , async ( ) => {
113
113
const opts = delegatedNode . apiAddr . toOptions ( )
114
+
114
115
const router = new DelegatedPeerRouting ( {
115
116
protocol : 'http' ,
116
117
port : opts . port ,
117
118
host : opts . host
118
119
} )
119
120
120
- const peer = await router . findPeer ( peerIdToFind . id )
121
- expect ( peer ) . to . exist ( )
122
- expect ( peer . id . toB58String ( ) ) . to . eql ( peerIdToFind . id )
121
+ const { id, addrs } = await router . findPeer ( peerIdToFind . id )
122
+ expect ( id ) . to . exist ( )
123
+ expect ( addrs ) . to . exist ( )
124
+ expect ( id ) . to . eql ( peerIdToFind . id )
123
125
} )
124
126
125
127
it ( 'should be able to find peers via the delegate with a peerid' , async ( ) => {
@@ -130,9 +132,11 @@ describe('DelegatedPeerRouting', function () {
130
132
host : opts . host
131
133
} )
132
134
133
- const peer = await router . findPeer ( PeerID . createFromB58String ( peerIdToFind . id ) )
134
- expect ( peer ) . to . exist ( )
135
- expect ( peer . id . toB58String ( ) ) . to . eql ( peerIdToFind . id )
135
+ const { id, addrs } = await router . findPeer ( PeerID . createFromB58String ( peerIdToFind . id ) )
136
+ expect ( id ) . to . exist ( )
137
+ expect ( addrs ) . to . exist ( )
138
+
139
+ expect ( id ) . to . eql ( peerIdToFind . id )
136
140
} )
137
141
138
142
it ( 'should be able to specify a timeout' , async ( ) => {
@@ -143,9 +147,11 @@ describe('DelegatedPeerRouting', function () {
143
147
host : opts . host
144
148
} )
145
149
146
- const peer = await router . findPeer ( PeerID . createFromB58String ( peerIdToFind . id ) , { timeout : 2000 } )
147
- expect ( peer ) . to . exist ( )
148
- expect ( peer . id . toB58String ( ) ) . to . eql ( peerIdToFind . id )
150
+ const { id, addrs } = await router . findPeer ( PeerID . createFromB58String ( peerIdToFind . id ) , { timeout : 2000 } )
151
+ expect ( id ) . to . exist ( )
152
+ expect ( addrs ) . to . exist ( )
153
+
154
+ expect ( id ) . to . eql ( peerIdToFind . id )
149
155
} )
150
156
151
157
it ( 'should not be able to find peers not on the network' , async ( ) => {
0 commit comments