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

Commit 6f1f568

Browse files
committed
test: add test for rabin chunker when only avgChunkSize is specified
License: MIT Signed-off-by: Dan Ordille <dordille@gmail.com>
1 parent 3ffbcd7 commit 6f1f568

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test/chunker-rabin.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,23 @@ describe('chunker: rabin', function () {
3636
)
3737
})
3838

39+
it('uses default min and max chunk size when only avgChunkSize is specified', (done) => {
40+
const b1 = Buffer.alloc(10 * 256)
41+
b1.fill('a')
42+
pull(
43+
pull.values([b1]),
44+
chunker({avgChunkSize: 256}),
45+
pull.collect((err, chunks) => {
46+
expect(err).to.not.exist()
47+
chunks.forEach((chunk) => {
48+
expect(chunk).to.have.length.gte(256 / 3)
49+
expect(chunk).to.have.length.lte(256 * (256 / 2))
50+
})
51+
done()
52+
})
53+
)
54+
})
55+
3956
it('256 KiB avg chunks of non scalar filesize', (done) => {
4057
const KiB256 = 262144
4158
let file = Buffer.concat([rawFile, Buffer.from('hello')])

0 commit comments

Comments
 (0)