diff --git a/package.json b/package.json index 177c5a177..ede4bfe9b 100644 --- a/package.json +++ b/package.json @@ -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,7 +64,7 @@ }, "devDependencies": { "aegir": "^20.3.2", - "ipfsd-ctl": "^1.0.0" + "ipfsd-ctl": "^2.1.0" }, "contributors": [ "Alan Shaw ", diff --git a/src/block/put.js b/src/block/put.js index 877457330..3e228207d 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()}`)