@@ -12,7 +12,7 @@ const BlockService = require('ipfs-block-service')
12
12
const pull = require ( 'pull-stream' )
13
13
const mh = require ( 'multihashes' )
14
14
const CID = require ( 'cids' )
15
- const IPLDResolver = require ( 'ipld-resolver ' )
15
+ const Ipld = require ( 'ipld' )
16
16
const loadFixture = require ( 'aegir/fixtures' )
17
17
const each = require ( 'async/each' )
18
18
@@ -163,7 +163,7 @@ module.exports = (repo) => {
163
163
describe ( 'importer: ' + strategy , function ( ) {
164
164
this . timeout ( 30 * 1000 )
165
165
166
- let ipldResolver
166
+ let ipld
167
167
168
168
const options = {
169
169
strategy : strategy ,
@@ -175,7 +175,7 @@ module.exports = (repo) => {
175
175
176
176
before ( ( ) => {
177
177
const bs = new BlockService ( repo )
178
- ipldResolver = new IPLDResolver ( bs )
178
+ ipld = new Ipld ( bs )
179
179
} )
180
180
181
181
it ( 'fails on bad input' , ( done ) => {
@@ -184,7 +184,7 @@ module.exports = (repo) => {
184
184
path : '200Bytes.txt' ,
185
185
content : 'banana'
186
186
} ] ) ,
187
- importer ( ipldResolver , options ) ,
187
+ importer ( ipld , options ) ,
188
188
pull . onEnd ( ( err ) => {
189
189
expect ( err ) . to . exist ( )
190
190
done ( )
@@ -195,7 +195,7 @@ module.exports = (repo) => {
195
195
it ( 'doesn\'t yield anything on empty source' , ( done ) => {
196
196
pull (
197
197
pull . empty ( ) ,
198
- importer ( ipldResolver , options ) ,
198
+ importer ( ipld , options ) ,
199
199
pull . collect ( ( err , nodes ) => {
200
200
expect ( err ) . to . not . exist ( )
201
201
expect ( nodes . length ) . to . be . eql ( 0 )
@@ -209,7 +209,7 @@ module.exports = (repo) => {
209
209
path : 'emptyfile' ,
210
210
content : pull . empty ( )
211
211
} ] ) ,
212
- importer ( ipldResolver , options ) ,
212
+ importer ( ipld , options ) ,
213
213
pull . collect ( ( err , nodes ) => {
214
214
expect ( err ) . to . not . exist ( )
215
215
expect ( nodes . length ) . to . be . eql ( 1 )
@@ -231,7 +231,7 @@ module.exports = (repo) => {
231
231
content : pull . values ( [ smallFile ] )
232
232
}
233
233
] ) ,
234
- importer ( ipldResolver , options ) ,
234
+ importer ( ipld , options ) ,
235
235
pull . onEnd ( ( err ) => {
236
236
expect ( err ) . to . exist ( )
237
237
expect ( err . message ) . to . be . eql ( 'detected more than one root' )
@@ -246,7 +246,7 @@ module.exports = (repo) => {
246
246
path : '200Bytes.txt' ,
247
247
content : pull . values ( [ smallFile ] )
248
248
} ] ) ,
249
- importer ( ipldResolver , options ) ,
249
+ importer ( ipld , options ) ,
250
250
pull . collect ( ( err , files ) => {
251
251
expect ( err ) . to . not . exist ( )
252
252
expect ( stringifyMh ( files ) ) . to . be . eql ( [ expected [ '200Bytes.txt' ] ] )
@@ -261,7 +261,7 @@ module.exports = (repo) => {
261
261
path : '200Bytes.txt' ,
262
262
content : smallFile
263
263
} ] ) ,
264
- importer ( ipldResolver , options ) ,
264
+ importer ( ipld , options ) ,
265
265
pull . collect ( ( err , files ) => {
266
266
expect ( err ) . to . not . exist ( )
267
267
expect ( stringifyMh ( files ) ) . to . be . eql ( [ expected [ '200Bytes.txt' ] ] )
@@ -276,7 +276,7 @@ module.exports = (repo) => {
276
276
path : 'foo/bar/200Bytes.txt' ,
277
277
content : pull . values ( [ smallFile ] )
278
278
} ] ) ,
279
- importer ( ipldResolver , options ) ,
279
+ importer ( ipld , options ) ,
280
280
pull . collect ( collected )
281
281
)
282
282
@@ -305,7 +305,7 @@ module.exports = (repo) => {
305
305
path : '1.2MiB.txt' ,
306
306
content : pull . values ( [ bigFile ] )
307
307
} ] ) ,
308
- importer ( ipldResolver , options ) ,
308
+ importer ( ipld , options ) ,
309
309
pull . collect ( ( err , files ) => {
310
310
expect ( err ) . to . not . exist ( )
311
311
expect ( stringifyMh ( files ) ) . to . be . eql ( [ expected [ '1.2MiB.txt' ] ] )
@@ -321,7 +321,7 @@ module.exports = (repo) => {
321
321
path : 'foo-big/1.2MiB.txt' ,
322
322
content : pull . values ( [ bigFile ] )
323
323
} ] ) ,
324
- importer ( ipldResolver , options ) ,
324
+ importer ( ipld , options ) ,
325
325
pull . collect ( ( err , files ) => {
326
326
expect ( err ) . to . not . exist ( )
327
327
@@ -340,7 +340,7 @@ module.exports = (repo) => {
340
340
pull . values ( [ {
341
341
path : 'empty-dir'
342
342
} ] ) ,
343
- importer ( ipldResolver , options ) ,
343
+ importer ( ipld , options ) ,
344
344
pull . collect ( ( err , files ) => {
345
345
expect ( err ) . to . not . exist ( )
346
346
@@ -360,7 +360,7 @@ module.exports = (repo) => {
360
360
path : 'pim/1.2MiB.txt' ,
361
361
content : pull . values ( [ bigFile ] )
362
362
} ] ) ,
363
- importer ( ipldResolver , options ) ,
363
+ importer ( ipld , options ) ,
364
364
pull . collect ( ( err , files ) => {
365
365
expect ( err ) . to . not . exist ( )
366
366
@@ -387,7 +387,7 @@ module.exports = (repo) => {
387
387
path : 'pam/1.2MiB.txt' ,
388
388
content : pull . values ( [ bigFile ] )
389
389
} ] ) ,
390
- importer ( ipldResolver , options ) ,
390
+ importer ( ipld , options ) ,
391
391
pull . collect ( ( err , files ) => {
392
392
expect ( err ) . to . not . exist ( )
393
393
@@ -442,15 +442,15 @@ module.exports = (repo) => {
442
442
const file = files [ 0 ]
443
443
expect ( file ) . to . exist ( )
444
444
445
- ipldResolver . get ( new CID ( file . multihash ) , ( err , res ) => {
445
+ ipld . get ( new CID ( file . multihash ) , ( err , res ) => {
446
446
expect ( err ) . to . exist ( )
447
447
done ( )
448
448
} )
449
449
}
450
450
451
451
pull (
452
452
pull . values ( [ inputFile ] ) ,
453
- importer ( ipldResolver , options ) ,
453
+ importer ( ipld , options ) ,
454
454
pull . collect ( onCollected )
455
455
)
456
456
} )
@@ -463,7 +463,7 @@ module.exports = (repo) => {
463
463
path : '1.2MiB.txt' ,
464
464
content : pull . values ( [ bigFile ] )
465
465
} ] ) ,
466
- importer ( ipldResolver , options ) ,
466
+ importer ( ipld , options ) ,
467
467
pull . collect ( ( ) => {
468
468
expect ( options . progress . called ) . to . equal ( true )
469
469
expect ( options . progress . args [ 0 ] [ 0 ] ) . to . equal ( 1024 )
@@ -496,7 +496,7 @@ module.exports = (repo) => {
496
496
497
497
each ( files , ( file , cb ) => {
498
498
const cid = new CID ( file . multihash ) . toV1 ( )
499
- ipldResolver . get ( cid , cb )
499
+ ipld . get ( cid , cb )
500
500
} , done )
501
501
}
502
502
@@ -513,7 +513,7 @@ module.exports = (repo) => {
513
513
createInputFile ( '/foo/bar' , 262144 + 876 ) ,
514
514
createInputFile ( '/foo/bar' , 262144 + 21 )
515
515
] ) ,
516
- importer ( ipldResolver , options ) ,
516
+ importer ( ipld , options ) ,
517
517
pull . collect ( onCollected )
518
518
)
519
519
} )
0 commit comments