From 984e9a8b8653de674efd4f225df6ef4988c803b9 Mon Sep 17 00:00:00 2001 From: Alan Shaw Date: Thu, 20 Sep 2018 12:32:26 +0100 Subject: [PATCH] fix: test for buffer with options Previously this test was using the default options so we weren't able to tell if the output was correct when given options that weren't the defaults! License: MIT Signed-off-by: Alan Shaw --- js/src/block/put.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/js/src/block/put.js b/js/src/block/put.js index e3f5ed8a..205b93f3 100644 --- a/js/src/block/put.js +++ b/js/src/block/put.js @@ -57,17 +57,18 @@ module.exports = (createCommon, options) => { }) it('should put a buffer, using options', (done) => { - const expectedHash = 'QmPv52ekjS75L4JmHpXVeuJ5uX2ecSfSZo88NSyxwA3rAQ' - const blob = Buffer.from('blorb') + const blob = Buffer.from(`TEST${Date.now()}`) ipfs.block.put(blob, { - format: 'dag-pb', - mhtype: 'sha2-256', - version: 0 + format: 'raw', + mhtype: 'sha2-512', + version: 1 }, (err, block) => { expect(err).to.not.exist() expect(block.data).to.be.eql(blob) - expect(block.cid.multihash).to.eql(multihash.fromB58String(expectedHash)) + expect(block.cid.version).to.equal(1) + expect(block.cid.codec).to.equal('raw') + expect(multihash.decode(block.cid.multihash).name).to.equal('sha2-512') done() }) })