@@ -32,10 +32,13 @@ module.exports = (common) => {
32
32
'files/ipfs.txt' : fs . readFileSync ( path . join ( __dirname , './data/test-folder/files/ipfs.txt' ) )
33
33
}
34
34
35
- common . setup ( ( err , _ipfs ) => {
35
+ common . setup ( ( err , factory ) => {
36
36
expect ( err ) . to . not . exist
37
- ipfs = _ipfs
38
- done ( )
37
+ factory . spawnNode ( ( err , node ) => {
38
+ expect ( err ) . to . not . exist
39
+ ipfs = node
40
+ done ( )
41
+ } )
39
42
} )
40
43
} )
41
44
@@ -187,24 +190,24 @@ module.exports = (common) => {
187
190
188
191
describe ( '.cat' , ( ) => {
189
192
it ( 'with a base58 string encoded multihash' , ( done ) => {
190
- const hash = 'QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB '
193
+ const hash = 'Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP '
191
194
ipfs . cat ( hash , ( err , stream ) => {
192
195
expect ( err ) . to . not . exist
193
196
stream . pipe ( bl ( ( err , data ) => {
194
197
expect ( err ) . to . not . exist
195
- expect ( data . toString ( ) ) . to . contain ( 'Check out some of the other files in this directory: ' )
198
+ expect ( data . toString ( ) ) . to . contain ( 'Plz add me! ' )
196
199
done ( )
197
200
} ) )
198
201
} )
199
202
} )
200
203
201
204
it ( 'with a multihash' , ( done ) => {
202
- const mhBuf = new Buffer ( bs58 . decode ( 'QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB ' ) )
205
+ const mhBuf = new Buffer ( bs58 . decode ( 'Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP ' ) )
203
206
ipfs . cat ( mhBuf , ( err , stream ) => {
204
207
expect ( err ) . to . not . exist
205
208
stream . pipe ( bl ( ( err , data ) => {
206
209
expect ( err ) . to . not . exist
207
- expect ( data . toString ( ) ) . to . contain ( 'Check out some of the other files in this directory: ' )
210
+ expect ( data . toString ( ) ) . to . contain ( 'Plz add me! ' )
208
211
done ( )
209
212
} ) )
210
213
} )
@@ -240,13 +243,13 @@ module.exports = (common) => {
240
243
241
244
describe ( '.cat' , ( ) => {
242
245
it ( 'with a base58 multihash encoded string' , ( ) => {
243
- const hash = 'QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB '
246
+ const hash = 'Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP '
244
247
245
248
return ipfs . cat ( hash )
246
249
. then ( ( stream ) => {
247
250
stream . pipe ( bl ( ( err , data ) => {
248
251
expect ( err ) . to . not . exist
249
- expect ( data . toString ( ) ) . to . contain ( 'Check out some of the other files in this directory: ' )
252
+ expect ( data . toString ( ) ) . to . contain ( 'Plz add me! ' )
250
253
} ) )
251
254
} )
252
255
} )
@@ -268,12 +271,12 @@ module.exports = (common) => {
268
271
} )
269
272
270
273
it ( 'with a multihash' , ( ) => {
271
- const hash = new Buffer ( bs58 . decode ( 'QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB ' ) )
274
+ const hash = new Buffer ( bs58 . decode ( 'Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP ' ) )
272
275
return ipfs . cat ( hash )
273
276
. then ( ( stream ) => {
274
277
stream . pipe ( bl ( ( err , data ) => {
275
278
expect ( err ) . to . not . exist
276
- expect ( data . toString ( ) ) . to . contain ( 'Check out some of the other files in this directory: ' )
279
+ expect ( data . toString ( ) ) . to . contain ( 'Plz add me! ' )
277
280
} ) )
278
281
} )
279
282
} )
@@ -282,31 +285,31 @@ module.exports = (common) => {
282
285
283
286
describe ( '.get' , ( ) => {
284
287
it ( 'with a base58 encoded multihash' , ( done ) => {
285
- const hash = 'QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB '
288
+ const hash = 'Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP '
286
289
ipfs . files . get ( hash , ( err , stream ) => {
287
290
expect ( err ) . to . not . exist
288
291
stream . pipe ( concat ( ( files ) => {
289
292
expect ( err ) . to . not . exist
290
293
expect ( files ) . to . be . length ( 1 )
291
294
expect ( files [ 0 ] . path ) . to . equal ( hash )
292
295
files [ 0 ] . content . pipe ( concat ( ( content ) => {
293
- expect ( content . toString ( ) ) . to . contain ( 'Check out some of the other files in this directory: ' )
296
+ expect ( content . toString ( ) ) . to . contain ( 'Plz add me! ' )
294
297
done ( )
295
298
} ) )
296
299
} ) )
297
300
} )
298
301
} )
299
302
300
303
it ( 'with a multihash' , ( done ) => {
301
- const hash = 'QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB '
304
+ const hash = 'Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP '
302
305
const mhBuf = new Buffer ( bs58 . decode ( hash ) )
303
306
ipfs . files . get ( mhBuf , ( err , stream ) => {
304
307
expect ( err ) . to . not . exist
305
308
stream . pipe ( concat ( ( files ) => {
306
309
expect ( files ) . to . be . length ( 1 )
307
310
expect ( files [ 0 ] . path ) . to . deep . equal ( hash )
308
311
files [ 0 ] . content . pipe ( concat ( ( content ) => {
309
- expect ( content . toString ( ) ) . to . contain ( 'Check out some of the other files in this directory: ' )
312
+ expect ( content . toString ( ) ) . to . contain ( 'Plz add me! ' )
310
313
done ( )
311
314
} ) )
312
315
} ) )
@@ -398,14 +401,14 @@ module.exports = (common) => {
398
401
399
402
describe ( 'promise' , ( ) => {
400
403
it ( 'with a base58 encoded string' , ( done ) => {
401
- const hash = 'QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB '
404
+ const hash = 'Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP '
402
405
ipfs . files . get ( hash )
403
406
. then ( ( stream ) => {
404
407
stream . pipe ( concat ( ( files ) => {
405
408
expect ( files ) . to . be . length ( 1 )
406
409
expect ( files [ 0 ] . path ) . to . equal ( hash )
407
410
files [ 0 ] . content . pipe ( concat ( ( content ) => {
408
- expect ( content . toString ( ) ) . to . contain ( 'Check out some of the other files in this directory: ' )
411
+ expect ( content . toString ( ) ) . to . contain ( 'Plz add me! ' )
409
412
done ( )
410
413
} ) )
411
414
} ) )
0 commit comments