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

fix: test for buffer with options #370

Merged
merged 1 commit into from
Sep 20, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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