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

Commit 965bdcb

Browse files
committed
test: add test for retreive empty block
Added originally in #308 License: MIT Signed-off-by: Alan Shaw <[email protected]>
1 parent eb9e785 commit 965bdcb

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

js/src/block/get.js

+16
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,22 @@ module.exports = (createCommon, options) => {
5454
})
5555
})
5656

57+
it('should get an empty block', (done) => {
58+
ipfs.block.put(Buffer.alloc(0), {
59+
format: 'dag-pb',
60+
mhtype: 'sha2-256',
61+
version: 0
62+
}, (err, block) => {
63+
expect(err).to.not.exist()
64+
65+
ipfs.block.get(block.cid, (err, block) => {
66+
expect(err).to.not.exist()
67+
expect(block.data).to.eql(Buffer.alloc(0))
68+
done()
69+
})
70+
})
71+
})
72+
5773
// TODO it.skip('Promises support', (done) => {})
5874
})
5975
}

0 commit comments

Comments
 (0)