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

Commit fbedbb9

Browse files
authored
Merge pull request #308 from ipfs/test/add-empty-block-test
test: add test for retrieving an empty block
2 parents 66c0efd + 7964f40 commit fbedbb9

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

js/src/block.js

+16
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,22 @@ module.exports = (common) => {
123123
})
124124
})
125125

126+
it('should get an empty block', (done) => {
127+
ipfs.block.put(Buffer.alloc(0), {
128+
format: 'dag-pb',
129+
mhtype: 'sha2-256',
130+
version: 0
131+
}, (err, block) => {
132+
expect(err).to.not.exist()
133+
134+
ipfs.block.get(block.cid, (err, block) => {
135+
expect(err).to.not.exist()
136+
expect(block.data).to.eql(Buffer.alloc(0))
137+
done()
138+
})
139+
})
140+
})
141+
126142
// TODO it.skip('Promises support', (done) => {})
127143
})
128144

0 commit comments

Comments
 (0)