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

Commit

Permalink
fix: test for buffer with options (#370)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
alanshaw committed Sep 20, 2018
1 parent a7bdb9a commit d456245
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions js/src/block/put.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
})
})
Expand Down

0 comments on commit d456245

Please sign in to comment.