This repository has been archived by the owner on Aug 12, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fixes #230 by returning a through stream that emits the error in…
…stead of throwing it
- Loading branch information
1 parent
e26a868
commit fdd8429
Showing
4 changed files
with
43 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* eslint-env mocha */ | ||
'use strict' | ||
|
||
const chunker = require('./../src/chunker/rabin') | ||
const chai = require('chai') | ||
chai.use(require('dirty-chai')) | ||
const expect = chai.expect | ||
const pull = require('pull-stream') | ||
|
||
describe('chunker: rabin browser', function () { | ||
it('returns an error', (done) => { | ||
const b1 = Buffer.alloc(2 * 256) | ||
const b2 = Buffer.alloc(1 * 256) | ||
const b3 = Buffer.alloc(5 * 256) | ||
|
||
b1.fill('a') | ||
b2.fill('b') | ||
b3.fill('c') | ||
|
||
pull( | ||
pull.values([b1, b2, b3]), | ||
chunker({minChunkSize: 48, avgChunkSize: 96, maxChunkSize: 192}), | ||
pull.collect((err) => { | ||
expect(err).to.exist() | ||
expect(err.message).to.include('Rabin chunker not available') | ||
|
||
done() | ||
}) | ||
) | ||
}) | ||
}) |