@@ -15,7 +15,7 @@ const factory = createFactory({
15
15
ipfsBin : isNode ? require ( 'go-ipfs' ) . path ( ) : undefined ,
16
16
test : true ,
17
17
disposable : true ,
18
- endpoint : 'http://localhost:57483 '
18
+ endpoint : 'http://localhost:57583 '
19
19
} )
20
20
21
21
async function spawnNode ( bootstrap = [ ] ) {
@@ -74,7 +74,7 @@ describe('DelegatedPeerRouting', function () {
74
74
} )
75
75
76
76
it ( 'should accept an http api client instance at construction time' , ( ) => {
77
- const client = ipfsHttpClient ( {
77
+ const client = ipfsHttpClient . create ( {
78
78
protocol : 'http' ,
79
79
port : 8000 ,
80
80
host : 'localhost'
@@ -97,7 +97,7 @@ describe('DelegatedPeerRouting', function () {
97
97
it ( 'should be able to find peers via the delegate with a peer id string' , async ( ) => {
98
98
const opts = delegatedNode . apiAddr . toOptions ( )
99
99
100
- const router = new DelegatedPeerRouting ( ipfsHttpClient ( {
100
+ const router = new DelegatedPeerRouting ( ipfsHttpClient . create ( {
101
101
protocol : 'http' ,
102
102
port : opts . port ,
103
103
host : opts . host
@@ -114,13 +114,13 @@ describe('DelegatedPeerRouting', function () {
114
114
115
115
it ( 'should be able to find peers via the delegate with a peerid' , async ( ) => {
116
116
const opts = delegatedNode . apiAddr . toOptions ( )
117
- const router = new DelegatedPeerRouting ( ipfsHttpClient ( {
117
+ const router = new DelegatedPeerRouting ( ipfsHttpClient . create ( {
118
118
protocol : 'http' ,
119
119
port : opts . port ,
120
120
host : opts . host
121
121
} ) )
122
122
123
- const peer = await router . findPeer ( PeerID . createFromB58String ( peerIdToFind . id ) )
123
+ const peer = await router . findPeer ( PeerID . parse ( peerIdToFind . id ) )
124
124
expect ( peer ) . to . be . ok ( )
125
125
126
126
const { id, multiaddrs } = peer
@@ -132,13 +132,13 @@ describe('DelegatedPeerRouting', function () {
132
132
133
133
it ( 'should be able to specify a timeout' , async ( ) => {
134
134
const opts = delegatedNode . apiAddr . toOptions ( )
135
- const router = new DelegatedPeerRouting ( ipfsHttpClient ( {
135
+ const router = new DelegatedPeerRouting ( ipfsHttpClient . create ( {
136
136
protocol : 'http' ,
137
137
port : opts . port ,
138
138
host : opts . host
139
139
} ) )
140
140
141
- const peer = await router . findPeer ( PeerID . createFromB58String ( peerIdToFind . id ) , { timeout : 2000 } )
141
+ const peer = await router . findPeer ( PeerID . parse ( peerIdToFind . id ) , { timeout : 2000 } )
142
142
expect ( peer ) . to . be . ok ( )
143
143
144
144
const { id, multiaddrs } = peer
@@ -150,7 +150,7 @@ describe('DelegatedPeerRouting', function () {
150
150
151
151
it ( 'should not be able to find peers not on the network' , async ( ) => {
152
152
const opts = delegatedNode . apiAddr . toOptions ( )
153
- const router = new DelegatedPeerRouting ( ipfsHttpClient ( {
153
+ const router = new DelegatedPeerRouting ( ipfsHttpClient . create ( {
154
154
protocol : 'http' ,
155
155
port : opts . port ,
156
156
host : opts . host
@@ -167,16 +167,16 @@ describe('DelegatedPeerRouting', function () {
167
167
it ( 'should be able to query for the closest peers' , async ( ) => {
168
168
const opts = delegatedNode . apiAddr . toOptions ( )
169
169
170
- const router = new DelegatedPeerRouting ( ipfsHttpClient ( {
170
+ const router = new DelegatedPeerRouting ( ipfsHttpClient . create ( {
171
171
protocol : 'http' ,
172
172
port : opts . port ,
173
173
host : opts . host
174
174
} ) )
175
175
176
176
const nodeId = await delegatedNode . api . id ( )
177
- const delegatePeerId = PeerID . createFromCID ( nodeId . id )
177
+ const delegatePeerId = PeerID . parse ( nodeId . id )
178
178
179
- const key = PeerID . createFromB58String ( peerIdToFind . id ) . id
179
+ const key = PeerID . parse ( peerIdToFind . id ) . id
180
180
const results = await concat ( router . getClosestPeers ( key ) )
181
181
182
182
// we should be closest to the 2 other peers
@@ -188,17 +188,17 @@ describe('DelegatedPeerRouting', function () {
188
188
} )
189
189
} )
190
190
191
- it ( 'should find closest peers even if the peer doesnt exist' , async ( ) => {
191
+ it ( 'should find closest peers even if the peer does not exist' , async ( ) => {
192
192
const opts = delegatedNode . apiAddr . toOptions ( )
193
193
194
- const router = new DelegatedPeerRouting ( ipfsHttpClient ( {
194
+ const router = new DelegatedPeerRouting ( ipfsHttpClient . create ( {
195
195
protocol : 'http' ,
196
196
port : opts . port ,
197
197
host : opts . host
198
198
} ) )
199
199
200
200
const nodeId = await delegatedNode . api . id ( )
201
- const delegatePeerId = PeerID . createFromCID ( nodeId . id )
201
+ const delegatePeerId = PeerID . parse ( nodeId . id )
202
202
203
203
const peerId = await PeerID . create ( { keyType : 'ed25519' } )
204
204
const results = await concat ( router . getClosestPeers ( peerId . id ) )
0 commit comments