@@ -7,14 +7,14 @@ const exporter = require('./../src').exporter
7
7
const chai = require ( 'chai' )
8
8
chai . use ( require ( 'dirty-chai' ) )
9
9
const expect = chai . expect
10
- const mh = require ( 'multihashes' )
11
10
const BlockService = require ( 'ipfs-block-service' )
12
11
const Ipld = require ( 'ipld' )
13
12
const pull = require ( 'pull-stream' )
14
13
const pushable = require ( 'pull-pushable' )
15
14
const whilst = require ( 'async/whilst' )
16
15
const setImmediate = require ( 'async/setImmediate' )
17
16
const leftPad = require ( 'left-pad' )
17
+ const CID = require ( 'cids' )
18
18
19
19
module . exports = ( repo ) => {
20
20
describe ( 'builder: directory sharding' , function ( ) {
@@ -87,9 +87,9 @@ module.exports = (repo) => {
87
87
pull . collect ( ( err , nodes ) => {
88
88
expect ( err ) . to . not . exist ( )
89
89
expect ( nodes . length ) . to . be . eql ( 2 )
90
- const expectedHash = mh . toB58String ( nonShardedHash )
90
+ const expectedHash = new CID ( nonShardedHash ) . toBaseEncodedString ( )
91
91
expect ( nodes [ 0 ] . path ) . to . be . eql ( expectedHash )
92
- expect ( mh . toB58String ( nodes [ 0 ] . hash ) ) . to . be . eql ( expectedHash )
92
+ expect ( new CID ( nodes [ 0 ] . hash ) . toBaseEncodedString ( ) ) . to . be . eql ( expectedHash )
93
93
expect ( nodes [ 1 ] . path ) . to . be . eql ( expectedHash + '/b' )
94
94
expect ( nodes [ 1 ] . size ) . to . be . eql ( 29 )
95
95
pull (
@@ -113,7 +113,7 @@ module.exports = (repo) => {
113
113
pull . collect ( ( err , nodes ) => {
114
114
expect ( err ) . to . not . exist ( )
115
115
expect ( nodes . length ) . to . be . eql ( 2 )
116
- const expectedHash = mh . toB58String ( shardedHash )
116
+ const expectedHash = new CID ( shardedHash ) . toBaseEncodedString ( )
117
117
expect ( nodes [ 0 ] . path ) . to . be . eql ( expectedHash )
118
118
expect ( nodes [ 0 ] . hash ) . to . be . eql ( expectedHash )
119
119
expect ( nodes [ 1 ] . path ) . to . be . eql ( expectedHash + '/b' )
@@ -209,7 +209,7 @@ module.exports = (repo) => {
209
209
function eachPath ( path , index ) {
210
210
if ( ! index ) {
211
211
// first dir
212
- expect ( path ) . to . be . eql ( mh . toB58String ( rootHash ) )
212
+ expect ( path ) . to . be . eql ( new CID ( rootHash ) . toBaseEncodedString ( ) )
213
213
const entry = entries [ path ]
214
214
expect ( entry ) . to . exist ( )
215
215
expect ( entry . content ) . to . not . exist ( )
@@ -315,7 +315,7 @@ module.exports = (repo) => {
315
315
if ( ! index ) {
316
316
// first dir
317
317
if ( depth === 1 ) {
318
- expect ( path ) . to . be . eql ( mh . toB58String ( rootHash ) )
318
+ expect ( path ) . to . be . eql ( new CID ( rootHash ) . toBaseEncodedString ( ) )
319
319
}
320
320
const entry = entries [ path ]
321
321
expect ( entry ) . to . exist ( )
@@ -338,7 +338,7 @@ module.exports = (repo) => {
338
338
} )
339
339
340
340
it ( 'exports a big dir with subpath' , ( done ) => {
341
- const exportHash = mh . toB58String ( rootHash ) + '/big/big/2000'
341
+ const exportHash = new CID ( rootHash ) . toBaseEncodedString ( ) + '/big/big/2000'
342
342
pull (
343
343
exporter ( exportHash , ipld ) ,
344
344
pull . collect ( collected )
0 commit comments