@@ -15,7 +15,7 @@ const factory = createFactory({
1515 ipfsBin : isNode ? require ( 'go-ipfs' ) . path ( ) : undefined ,
1616 test : true ,
1717 disposable : true ,
18- endpoint : 'http://localhost:57483 '
18+ endpoint : 'http://localhost:57583 '
1919} )
2020
2121async function spawnNode ( bootstrap = [ ] ) {
@@ -74,7 +74,7 @@ describe('DelegatedPeerRouting', function () {
7474 } )
7575
7676 it ( 'should accept an http api client instance at construction time' , ( ) => {
77- const client = ipfsHttpClient ( {
77+ const client = ipfsHttpClient . create ( {
7878 protocol : 'http' ,
7979 port : 8000 ,
8080 host : 'localhost'
@@ -97,7 +97,7 @@ describe('DelegatedPeerRouting', function () {
9797 it ( 'should be able to find peers via the delegate with a peer id string' , async ( ) => {
9898 const opts = delegatedNode . apiAddr . toOptions ( )
9999
100- const router = new DelegatedPeerRouting ( ipfsHttpClient ( {
100+ const router = new DelegatedPeerRouting ( ipfsHttpClient . create ( {
101101 protocol : 'http' ,
102102 port : opts . port ,
103103 host : opts . host
@@ -114,13 +114,13 @@ describe('DelegatedPeerRouting', function () {
114114
115115 it ( 'should be able to find peers via the delegate with a peerid' , async ( ) => {
116116 const opts = delegatedNode . apiAddr . toOptions ( )
117- const router = new DelegatedPeerRouting ( ipfsHttpClient ( {
117+ const router = new DelegatedPeerRouting ( ipfsHttpClient . create ( {
118118 protocol : 'http' ,
119119 port : opts . port ,
120120 host : opts . host
121121 } ) )
122122
123- const peer = await router . findPeer ( PeerID . createFromB58String ( peerIdToFind . id ) )
123+ const peer = await router . findPeer ( PeerID . parse ( peerIdToFind . id ) )
124124 expect ( peer ) . to . be . ok ( )
125125
126126 const { id, multiaddrs } = peer
@@ -132,13 +132,13 @@ describe('DelegatedPeerRouting', function () {
132132
133133 it ( 'should be able to specify a timeout' , async ( ) => {
134134 const opts = delegatedNode . apiAddr . toOptions ( )
135- const router = new DelegatedPeerRouting ( ipfsHttpClient ( {
135+ const router = new DelegatedPeerRouting ( ipfsHttpClient . create ( {
136136 protocol : 'http' ,
137137 port : opts . port ,
138138 host : opts . host
139139 } ) )
140140
141- const peer = await router . findPeer ( PeerID . createFromB58String ( peerIdToFind . id ) , { timeout : 2000 } )
141+ const peer = await router . findPeer ( PeerID . parse ( peerIdToFind . id ) , { timeout : 2000 } )
142142 expect ( peer ) . to . be . ok ( )
143143
144144 const { id, multiaddrs } = peer
@@ -150,7 +150,7 @@ describe('DelegatedPeerRouting', function () {
150150
151151 it ( 'should not be able to find peers not on the network' , async ( ) => {
152152 const opts = delegatedNode . apiAddr . toOptions ( )
153- const router = new DelegatedPeerRouting ( ipfsHttpClient ( {
153+ const router = new DelegatedPeerRouting ( ipfsHttpClient . create ( {
154154 protocol : 'http' ,
155155 port : opts . port ,
156156 host : opts . host
@@ -167,16 +167,16 @@ describe('DelegatedPeerRouting', function () {
167167 it ( 'should be able to query for the closest peers' , async ( ) => {
168168 const opts = delegatedNode . apiAddr . toOptions ( )
169169
170- const router = new DelegatedPeerRouting ( ipfsHttpClient ( {
170+ const router = new DelegatedPeerRouting ( ipfsHttpClient . create ( {
171171 protocol : 'http' ,
172172 port : opts . port ,
173173 host : opts . host
174174 } ) )
175175
176176 const nodeId = await delegatedNode . api . id ( )
177- const delegatePeerId = PeerID . createFromCID ( nodeId . id )
177+ const delegatePeerId = PeerID . parse ( nodeId . id )
178178
179- const key = PeerID . createFromB58String ( peerIdToFind . id ) . id
179+ const key = PeerID . parse ( peerIdToFind . id ) . id
180180 const results = await concat ( router . getClosestPeers ( key ) )
181181
182182 // we should be closest to the 2 other peers
@@ -188,17 +188,17 @@ describe('DelegatedPeerRouting', function () {
188188 } )
189189 } )
190190
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 ( ) => {
192192 const opts = delegatedNode . apiAddr . toOptions ( )
193193
194- const router = new DelegatedPeerRouting ( ipfsHttpClient ( {
194+ const router = new DelegatedPeerRouting ( ipfsHttpClient . create ( {
195195 protocol : 'http' ,
196196 port : opts . port ,
197197 host : opts . host
198198 } ) )
199199
200200 const nodeId = await delegatedNode . api . id ( )
201- const delegatePeerId = PeerID . createFromCID ( nodeId . id )
201+ const delegatePeerId = PeerID . parse ( nodeId . id )
202202
203203 const peerId = await PeerID . create ( { keyType : 'ed25519' } )
204204 const results = await concat ( router . getClosestPeers ( peerId . id ) )
0 commit comments