Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit e9eca18

Browse files
authored
chore: update unixfs deps (#2809)
* chore: update unixfs deps * fix: fix up tests * fix: update cid, verified with go * fix: linting * fix: fix tests
1 parent 6376cec commit e9eca18

File tree

5 files changed

+31
-12
lines changed

5 files changed

+31
-12
lines changed

packages/interface-ipfs-core/src/add.js

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -533,16 +533,35 @@ module.exports = (common, options) => {
533533
return expect(all(ipfs.add(urlSource('123http://invalid')))).to.eventually.be.rejected()
534534
})
535535

536-
it('should override raw leaves when file is smaller than one block', async () => {
536+
it('should respect raw leaves when file is smaller than one block and no metadata is present', async () => {
537537
const files = await all(ipfs.add(Buffer.from([0, 1, 2]), {
538538
cidVersion: 1,
539539
rawLeaves: true
540540
}))
541541

542542
expect(files.length).to.equal(1)
543-
expect(files[0].cid.toString()).to.equal('bafybeide2caf5we5a7izifzwzz5ds2gla67vsfgrzvbzpnyyirnfzgwf5e')
543+
expect(files[0].cid.toString()).to.equal('bafkreifojmzibzlof6xyh5auu3r5vpu5l67brf3fitaf73isdlglqw2t7q')
544+
expect(files[0].cid.codec).to.equal('raw')
545+
expect(files[0].size).to.equal(3)
546+
})
547+
548+
it('should override raw leaves when file is smaller than one block and metadata is present', async () => {
549+
const files = await all(ipfs.add({
550+
content: Buffer.from([0, 1, 2]),
551+
mode: 0o123,
552+
mtime: {
553+
secs: 1000,
554+
nsecs: 0
555+
}
556+
}, {
557+
cidVersion: 1,
558+
rawLeaves: true
559+
}))
560+
561+
expect(files.length).to.equal(1)
562+
expect(files[0].cid.toString()).to.equal('bafybeifmayxiu375ftlgydntjtffy5cssptjvxqw6vyuvtymntm37mpvua')
544563
expect(files[0].cid.codec).to.equal('dag-pb')
545-
expect(files[0].size).to.equal(11)
564+
expect(files[0].size).to.equal(18)
546565
})
547566
})
548567
}

packages/ipfs-http-client/test/interface.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ describe('interface-ipfs-core tests', () => {
4545
reason: 'TODO not implemented in go-ipfs yet'
4646
},
4747
{
48-
name: 'should override raw leaves when file is smaller than one block',
49-
reason: 'TODO not implemented in go-ipfs yet https://github.com/ipfs/go-ipfs/issues/6940'
48+
name: 'should override raw leaves when file is smaller than one block and metadata is present',
49+
reason: 'TODO not implemented in go-ipfs yet'
5050
}
5151
]
5252
})

packages/ipfs-mfs/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@
6767
"interface-datastore": "^0.8.0",
6868
"ipfs-multipart": "^0.3.0",
6969
"ipfs-unixfs": "^1.0.0",
70-
"ipfs-unixfs-exporter": "^1.0.0",
71-
"ipfs-unixfs-importer": "^1.0.0",
70+
"ipfs-unixfs-exporter": "^1.0.1",
71+
"ipfs-unixfs-importer": "^1.0.1",
7272
"ipfs-utils": "^0.7.0",
7373
"ipld-dag-pb": "^0.18.2",
7474
"it-all": "^1.0.1",

packages/ipfs/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@
101101
"ipfs-multipart": "^0.3.0",
102102
"ipfs-repo": "^0.30.1",
103103
"ipfs-unixfs": "^1.0.0",
104-
"ipfs-unixfs-exporter": "^1.0.0",
105-
"ipfs-unixfs-importer": "^1.0.0",
104+
"ipfs-unixfs-exporter": "^1.0.1",
105+
"ipfs-unixfs-importer": "^1.0.1",
106106
"ipfs-utils": "^0.7.2",
107107
"ipld": "^0.25.0",
108108
"ipld-bitcoin": "^0.3.0",
@@ -182,7 +182,7 @@
182182
"go-ipfs-dep": "0.4.23-3",
183183
"hat": "0.0.3",
184184
"interface-ipfs-core": "^0.132.0",
185-
"ipfs-interop": "github:ipfs/interop#disable-small-file-with-raw-leaves-test",
185+
"ipfs-interop": "^1.0.0",
186186
"ipfsd-ctl": "^3.0.0",
187187
"it-first": "^1.0.1",
188188
"ncp": "^2.0.0",

packages/ipfs/test/core/files.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ describe('files', function () {
3939
}))
4040

4141
expect(files.length).to.equal(1)
42-
expect(files[0].cid.toString()).to.equal('bafybeide2caf5we5a7izifzwzz5ds2gla67vsfgrzvbzpnyyirnfzgwf5e')
43-
expect(files[0].size).to.equal(11)
42+
expect(files[0].cid.toString()).to.equal('bafkreifojmzibzlof6xyh5auu3r5vpu5l67brf3fitaf73isdlglqw2t7q')
43+
expect(files[0].size).to.equal(3)
4444
})
4545
})
4646
})

0 commit comments

Comments
 (0)