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

chore: update importer to only output unixfs things #2747

Merged
merged 1 commit into from
Mar 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions examples/test-ipfs-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
"bin": {
"test-ipfs-example": "./test.js"
},
"scripts": {
"test": "node ./test.js"
},
"license": "MIT",
"dependencies": {
"chromedriver": "^79.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/interface-ipfs-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"dirty-chai": "^2.0.1",
"hat": "0.0.3",
"ipfs-block": "^0.8.1",
"ipfs-unixfs": "^0.3.0",
"ipfs-unixfs": "^1.0.0",
"ipfs-utils": "^0.7.2",
"ipld-dag-cbor": "^0.15.1",
"ipld-dag-pb": "^0.18.2",
Expand Down
12 changes: 12 additions & 0 deletions packages/interface-ipfs-core/src/add.js
Original file line number Diff line number Diff line change
Expand Up @@ -532,5 +532,17 @@ module.exports = (common, options) => {
it('should not add from an invalid url', () => {
return expect(all(ipfs.add(urlSource('123http://invalid')))).to.eventually.be.rejected()
})

it('should override raw leaves when file is smaller than one block', async () => {
const files = await all(ipfs.add(Buffer.from([0, 1, 2]), {
cidVersion: 1,
rawLeaves: true
}))

expect(files.length).to.equal(1)
expect(files[0].cid.toString()).to.equal('bafybeide2caf5we5a7izifzwzz5ds2gla67vsfgrzvbzpnyyirnfzgwf5e')
expect(files[0].cid.codec).to.equal('dag-pb')
expect(files[0].size).to.equal(11)
})
})
}
4 changes: 4 additions & 0 deletions packages/ipfs-http-client/test/interface.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ describe('interface-ipfs-core tests', () => {
{
name: 'should ls with metadata',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should override raw leaves when file is smaller than one block',
reason: 'TODO not implemented in go-ipfs yet https://github.com/ipfs/go-ipfs/issues/6940'
}
]
})
Expand Down
6 changes: 3 additions & 3 deletions packages/ipfs-mfs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@
"hamt-sharding": "^1.0.0",
"interface-datastore": "^0.8.0",
"ipfs-multipart": "^0.3.0",
"ipfs-unixfs": "^0.3.0",
"ipfs-unixfs-exporter": "^0.41.0",
"ipfs-unixfs-importer": "^0.44.0",
"ipfs-unixfs": "^1.0.0",
"ipfs-unixfs-exporter": "^1.0.0",
"ipfs-unixfs-importer": "^1.0.0",
"ipfs-utils": "^0.7.0",
"ipld-dag-pb": "^0.18.2",
"it-all": "^1.0.1",
Expand Down
8 changes: 4 additions & 4 deletions packages/ipfs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@
"ipfs-mfs": "^1.0.0",
"ipfs-multipart": "^0.3.0",
"ipfs-repo": "^0.30.1",
"ipfs-unixfs": "^0.3.0",
"ipfs-unixfs-exporter": "^0.41.0",
"ipfs-unixfs-importer": "^0.44.0",
"ipfs-unixfs": "^1.0.0",
"ipfs-unixfs-exporter": "^1.0.0",
"ipfs-unixfs-importer": "^1.0.0",
"ipfs-utils": "^0.7.2",
"ipld": "^0.25.0",
"ipld-bitcoin": "^0.3.0",
Expand Down Expand Up @@ -182,7 +182,7 @@
"go-ipfs-dep": "0.4.23-3",
"hat": "0.0.3",
"interface-ipfs-core": "^0.132.0",
"ipfs-interop": "^1.0.0",
"ipfs-interop": "github:ipfs/interop#disable-small-file-with-raw-leaves-test",
"ipfsd-ctl": "^3.0.0",
"it-first": "^1.0.1",
"ncp": "^2.0.0",
Expand Down
11 changes: 0 additions & 11 deletions packages/ipfs/test/core/files.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,6 @@ describe('files', function () {
cidVersion: 1
}))

expect(files.length).to.equal(1)
expect(files[0].cid.toString()).to.equal('bafkreifojmzibzlof6xyh5auu3r5vpu5l67brf3fitaf73isdlglqw2t7q')
expect(files[0].size).to.equal(3)
})

it('should add a file with a v1 CID and not raw leaves', async () => {
const files = await all(ipfs.add(Buffer.from([0, 1, 2]), {
cidVersion: 1,
rawLeaves: false
}))

expect(files.length).to.equal(1)
expect(files[0].cid.toString()).to.equal('bafybeide2caf5we5a7izifzwzz5ds2gla67vsfgrzvbzpnyyirnfzgwf5e')
expect(files[0].size).to.equal(11)
Expand Down