File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
packages/ipfs-unixfs-importer/test Expand file tree Collapse file tree 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')
2020const uint8ArrayConcat = require ( 'uint8arrays/concat' )
2121const uint8ArrayFromString = require ( 'uint8arrays/from-string' )
2222const uint8ArrayToString = require ( 'uint8arrays/to-string' )
23+ const last = require ( 'it-last' )
2324
2425function stringifyMh ( files ) {
2526 return files . map ( ( file ) => {
@@ -1059,4 +1060,26 @@ describe('configuration', () => {
10591060 expect ( validated ) . to . be . true ( )
10601061 expect ( chunked ) . to . be . true ( )
10611062 } )
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+ } )
10621085} )
You can’t perform that action at this time.
0 commit comments