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

Commit

Permalink
Merge pull request #308 from ipfs/test/add-empty-block-test
Browse files Browse the repository at this point in the history
test: add test for retrieving an empty block
  • Loading branch information
alanshaw authored Jun 22, 2018
2 parents 66c0efd + 7964f40 commit fbedbb9
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions js/src/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,22 @@ module.exports = (common) => {
})
})

it('should get an empty block', (done) => {
ipfs.block.put(Buffer.alloc(0), {
format: 'dag-pb',
mhtype: 'sha2-256',
version: 0
}, (err, block) => {
expect(err).to.not.exist()

ipfs.block.get(block.cid, (err, block) => {
expect(err).to.not.exist()
expect(block.data).to.eql(Buffer.alloc(0))
done()
})
})
})

// TODO it.skip('Promises support', (done) => {})
})

Expand Down

0 comments on commit fbedbb9

Please sign in to comment.