@@ -75,7 +75,7 @@ describe('DelegatedContentRouting', function () {
75
75
const router = new DelegatedContentRouting ( selfId )
76
76
77
77
expect ( router . api ) . to . include ( {
78
- 'api-path' : '/api/v0/ ' ,
78
+ 'api-path' : '/api/v0' ,
79
79
protocol : 'https' ,
80
80
port : 443 ,
81
81
host : 'node0.delegate.ipfs.io'
@@ -88,7 +88,7 @@ describe('DelegatedContentRouting', function () {
88
88
} )
89
89
90
90
expect ( router . api ) . to . include ( {
91
- 'api-path' : '/api/v0/ ' ,
91
+ 'api-path' : '/api/v0' ,
92
92
protocol : 'https' ,
93
93
port : 443 ,
94
94
host : 'other.ipfs.io'
@@ -97,7 +97,7 @@ describe('DelegatedContentRouting', function () {
97
97
98
98
it ( 'should allow for overriding the api' , ( ) => {
99
99
const api = {
100
- 'api-path' : '/api/v1/ ' ,
100
+ 'api-path' : '/api/v1' ,
101
101
protocol : 'http' ,
102
102
port : 8000 ,
103
103
host : 'localhost'
@@ -132,7 +132,7 @@ describe('DelegatedContentRouting', function () {
132
132
expect ( providers . map ( ( p ) => p . id . toB58String ( ) ) ) . to . include ( selfId . toB58String ( ) , 'Did not include self node' )
133
133
} )
134
134
135
- it ( 'should be able to specify a maxTimeout ' , async ( ) => {
135
+ it ( 'should be able to specify a timeout ' , async ( ) => {
136
136
const opts = delegateNode . apiAddr . toOptions ( )
137
137
const routing = new DelegatedContentRouting ( selfId , {
138
138
protocol : 'http' ,
@@ -141,26 +141,23 @@ describe('DelegatedContentRouting', function () {
141
141
} )
142
142
143
143
const cid = new CID ( 'QmS4ustL54uo8FzR9455qaxZwuMiUhyvMcX9Ba8nUH4uVv' )
144
- const providers = await all ( routing . findProviders ( cid , { maxTimeout : 5e3 } ) )
144
+ const providers = await all ( routing . findProviders ( cid , { timeout : 5e3 } ) )
145
145
146
146
expect ( providers . map ( ( p ) => p . id . toB58String ( ) ) ) . to . include ( bootstrapId . id , 'Did not include bootstrap node' )
147
147
} )
148
148
} )
149
149
150
150
describe ( 'provide' , ( ) => {
151
151
it ( 'should be able to register as a content provider to the delegate node' , async ( ) => {
152
- let contentRouter
153
- let cid
154
-
155
152
const opts = delegateNode . apiAddr . toOptions ( )
156
- contentRouter = new DelegatedContentRouting ( selfId , {
153
+ const contentRouter = new DelegatedContentRouting ( selfId , {
157
154
protocol : 'http' ,
158
155
port : opts . port ,
159
156
host : opts . host
160
157
} )
161
158
162
159
const res = await selfNode . api . add ( Buffer . from ( `hello-${ Math . random ( ) } ` ) )
163
- cid = new CID ( res [ 0 ] . hash )
160
+ const cid = new CID ( res [ 0 ] . hash )
164
161
await contentRouter . provide ( cid )
165
162
const providers = await delegateNode . api . dht . findProvs ( cid . toBaseEncodedString ( ) )
166
163
0 commit comments