@@ -7,14 +7,14 @@ const exporter = require('./../src').exporter
77const chai = require ( 'chai' )
88chai . use ( require ( 'dirty-chai' ) )
99const expect = chai . expect
10- const mh = require ( 'multihashes' )
1110const BlockService = require ( 'ipfs-block-service' )
1211const Ipld = require ( 'ipld' )
1312const pull = require ( 'pull-stream' )
1413const pushable = require ( 'pull-pushable' )
1514const whilst = require ( 'async/whilst' )
1615const setImmediate = require ( 'async/setImmediate' )
1716const leftPad = require ( 'left-pad' )
17+ const CID = require ( 'cids' )
1818
1919module . exports = ( repo ) => {
2020 describe ( 'builder: directory sharding' , function ( ) {
@@ -87,9 +87,9 @@ module.exports = (repo) => {
8787 pull . collect ( ( err , nodes ) => {
8888 expect ( err ) . to . not . exist ( )
8989 expect ( nodes . length ) . to . be . eql ( 2 )
90- const expectedHash = mh . toB58String ( nonShardedHash )
90+ const expectedHash = new CID ( nonShardedHash ) . toBaseEncodedString ( )
9191 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 )
9393 expect ( nodes [ 1 ] . path ) . to . be . eql ( expectedHash + '/b' )
9494 expect ( nodes [ 1 ] . size ) . to . be . eql ( 29 )
9595 pull (
@@ -113,7 +113,7 @@ module.exports = (repo) => {
113113 pull . collect ( ( err , nodes ) => {
114114 expect ( err ) . to . not . exist ( )
115115 expect ( nodes . length ) . to . be . eql ( 2 )
116- const expectedHash = mh . toB58String ( shardedHash )
116+ const expectedHash = new CID ( shardedHash ) . toBaseEncodedString ( )
117117 expect ( nodes [ 0 ] . path ) . to . be . eql ( expectedHash )
118118 expect ( nodes [ 0 ] . hash ) . to . be . eql ( expectedHash )
119119 expect ( nodes [ 1 ] . path ) . to . be . eql ( expectedHash + '/b' )
@@ -209,7 +209,7 @@ module.exports = (repo) => {
209209 function eachPath ( path , index ) {
210210 if ( ! index ) {
211211 // first dir
212- expect ( path ) . to . be . eql ( mh . toB58String ( rootHash ) )
212+ expect ( path ) . to . be . eql ( new CID ( rootHash ) . toBaseEncodedString ( ) )
213213 const entry = entries [ path ]
214214 expect ( entry ) . to . exist ( )
215215 expect ( entry . content ) . to . not . exist ( )
@@ -315,7 +315,7 @@ module.exports = (repo) => {
315315 if ( ! index ) {
316316 // first dir
317317 if ( depth === 1 ) {
318- expect ( path ) . to . be . eql ( mh . toB58String ( rootHash ) )
318+ expect ( path ) . to . be . eql ( new CID ( rootHash ) . toBaseEncodedString ( ) )
319319 }
320320 const entry = entries [ path ]
321321 expect ( entry ) . to . exist ( )
@@ -338,7 +338,7 @@ module.exports = (repo) => {
338338 } )
339339
340340 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'
342342 pull (
343343 exporter ( exportHash , ipld ) ,
344344 pull . collect ( collected )
0 commit comments