File tree 1 file changed +23
-0
lines changed
packages/ipfs-unixfs-importer/test
1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ const blockApi = require('./helpers/block')
20
20
const uint8ArrayConcat = require ( 'uint8arrays/concat' )
21
21
const uint8ArrayFromString = require ( 'uint8arrays/from-string' )
22
22
const uint8ArrayToString = require ( 'uint8arrays/to-string' )
23
+ const last = require ( 'it-last' )
23
24
24
25
function stringifyMh ( files ) {
25
26
return files . map ( ( file ) => {
@@ -1059,4 +1060,26 @@ describe('configuration', () => {
1059
1060
expect ( validated ) . to . be . true ( )
1060
1061
expect ( chunked ) . to . be . true ( )
1061
1062
} )
1063
+
1064
+ it ( 'imports the same data with different CID versions and gets the same multihash' , async ( ) => {
1065
+ const ipld = await inMemory ( IPLD )
1066
+ const block = blockApi ( ipld )
1067
+ const buf = uint8ArrayFromString ( 'content' )
1068
+
1069
+ const { cid : cidV0 } = await last ( importer ( [ {
1070
+ content : buf
1071
+ } ] , block , {
1072
+ cidVersion : 0 ,
1073
+ rawLeaves : false
1074
+ } ) )
1075
+
1076
+ const { cid : cidV1 } = await last ( importer ( [ {
1077
+ content : buf
1078
+ } ] , block , {
1079
+ cidVersion : 1 ,
1080
+ rawLeaves : false
1081
+ } ) )
1082
+
1083
+ expect ( cidV0 . multihash ) . to . deep . equal ( cidV1 . multihash )
1084
+ } )
1062
1085
} )
You can’t perform that action at this time.
0 commit comments