Skip to content
This repository was archived by the owner on Mar 10, 2020. It is now read-only.

Commit d456245

Browse files
author
Alan Shaw
authored
fix: test for buffer with options (#370)
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 <alan.shaw@protocol.ai>
1 parent a7bdb9a commit d456245

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

Diff for: js/src/block/put.js

+7-6
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,18 @@ module.exports = (createCommon, options) => {
5757
})
5858

5959
it('should put a buffer, using options', (done) => {
60-
const expectedHash = 'QmPv52ekjS75L4JmHpXVeuJ5uX2ecSfSZo88NSyxwA3rAQ'
61-
const blob = Buffer.from('blorb')
60+
const blob = Buffer.from(`TEST${Date.now()}`)
6261

6362
ipfs.block.put(blob, {
64-
format: 'dag-pb',
65-
mhtype: 'sha2-256',
66-
version: 0
63+
format: 'raw',
64+
mhtype: 'sha2-512',
65+
version: 1
6766
}, (err, block) => {
6867
expect(err).to.not.exist()
6968
expect(block.data).to.be.eql(blob)
70-
expect(block.cid.multihash).to.eql(multihash.fromB58String(expectedHash))
69+
expect(block.cid.version).to.equal(1)
70+
expect(block.cid.codec).to.equal('raw')
71+
expect(multihash.decode(block.cid.multihash).name).to.equal('sha2-512')
7172
done()
7273
})
7374
})

0 commit comments

Comments
 (0)