diff --git a/CHANGELOG.md b/CHANGELOG.md index 6117bef8..b85aeead 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ + +# [0.132.0](https://github.com/ipfs/interface-ipfs-core/compare/v0.131.7...v0.132.0) (2020-02-09) + + +### Bug Fixes + +* add object.stat timeout leeway ([#586](https://github.com/ipfs/interface-ipfs-core/issues/586)) ([8b45ad0](https://github.com/ipfs/interface-ipfs-core/commit/8b45ad0)) + + + ## [0.131.7](https://github.com/ipfs/interface-ipfs-core/compare/v0.131.6...v0.131.7) (2020-02-03) diff --git a/package.json b/package.json index 177c5a17..e0736800 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "interface-ipfs-core", - "version": "0.131.7", + "version": "0.132.0", "description": "A test suite and interface you can use to implement a IPFS core interface.", "leadMaintainer": "Alan Shaw ", "main": "src/index.js", @@ -47,7 +47,7 @@ "hat": "0.0.3", "ipfs-block": "~0.8.0", "ipfs-unixfs": "^0.3.0", - "ipfs-utils": "^0.6.0", + "ipfs-utils": "^0.7.1", "ipld-dag-cbor": "~0.15.0", "ipld-dag-pb": "^0.18.1", "is-ipfs": "~0.6.1", @@ -64,11 +64,12 @@ }, "devDependencies": { "aegir": "^20.3.2", - "ipfsd-ctl": "^1.0.0" + "ipfsd-ctl": "^2.1.0" }, "contributors": [ "Alan Shaw ", "Alan Shaw ", + "Alex Potsides ", "Andrey ", "Dan Ordille ", "Dan Shields <35669742+NukeManDan@users.noreply.github.com>", @@ -118,7 +119,6 @@ "Vasco Santos ", "Volker Mische ", "Vutsal Singhal ", - "achingbrain ", "dirkmc ", "greenkeeper[bot] <23040076+greenkeeper[bot]@users.noreply.github.com>", "greenkeeper[bot] ", diff --git a/src/add.js b/src/add.js index 1172ec9a..222cc82c 100644 --- a/src/add.js +++ b/src/add.js @@ -320,6 +320,27 @@ module.exports = (common, options) => { .and.to.have.property('name').that.equals('TimeoutError') }) + it('should add a directory with only-hash=true', async function () { + this.slow(10 * 1000) + const content = String(Math.random() + Date.now()) + + const files = await all(ipfs.add([{ + path: '/foo/bar.txt', + content: Buffer.from(content) + }, { + path: '/foo/baz.txt', + content: Buffer.from(content) + }], { onlyHash: true })) + expect(files).to.have.length(3) + + await Promise.all( + files.map(file => expect(ipfs.object.get(file.cid, { timeout: 4000 })) + .to.eventually.be.rejected() + .and.to.have.property('name').that.equals('TimeoutError') + ) + ) + }) + it('should add with mode as string', async function () { this.slow(10 * 1000) const mode = '0777' diff --git a/src/block/put.js b/src/block/put.js index 87745733..3e228207 100644 --- a/src/block/put.js +++ b/src/block/put.js @@ -45,6 +45,16 @@ module.exports = (common, options) => { expect(block.cid.multihash).to.eql(multihash.fromB58String(expectedHash)) }) + it('should put a buffer, using CID string', async () => { + const expectedCid = 'bafyreietui4xdkiu4xvmx4fi2jivjtndbhb4drzpxomrjvd4mdz4w2avra' + const blob = Buffer.from(JSON.stringify({ hello: 'world' })) + + const block = await ipfs.block.put(blob, { cid: expectedCid }) + + expect(block.data).to.be.eql(blob) + expect(block.cid.toString()).to.eql(expectedCid) + }) + it('should put a buffer, using options', async () => { const blob = Buffer.from(`TEST${Date.now()}`) diff --git a/src/object/stat.js b/src/object/stat.js index b49ba3af..31baa201 100644 --- a/src/object/stat.js +++ b/src/object/stat.js @@ -66,7 +66,7 @@ module.exports = (common, options) => { expect(err.message).to.equal('failed to get block for QmNggDXca24S6cMPEYHZjeuc4QRmofkRrAEqVL3MzzzzzZ: context deadline exceeded') } - expect(timeForRequest).to.not.lessThan(timeout) + expect(timeForRequest).to.not.lessThan(timeout - 0.1) expect(timeForRequest).to.not.greaterThan(timeout + 1) })