Skip to content

Commit

Permalink
[test] Fix failing test on node 10
Browse files Browse the repository at this point in the history
  • Loading branch information
lpinca committed May 5, 2018
1 parent 6d8f1f4 commit bb9c21c
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions test/permessage-deflate.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -527,17 +527,14 @@ describe('PerMessageDeflate', function () {
it("doesn't call the callback twice when `maxPayload` is exceeded", function (done) {
const perMessageDeflate = new PerMessageDeflate({ threshold: 0 }, false, 25);
const buf = Buffer.from('A'.repeat(50));
const errors = [];

perMessageDeflate.accept([{}]);
perMessageDeflate.compress(buf, true, (err, data) => {
if (err) return done(err);

perMessageDeflate.decompress(data, true, (err) => errors.push(err));
perMessageDeflate._inflate.flush(() => {
assert.strictEqual(errors.length, 1);
assert.ok(errors[0] instanceof RangeError);
assert.strictEqual(errors[0].message, 'Max payload size exceeded');
perMessageDeflate.decompress(data, true, (err) => {
assert.ok(err instanceof RangeError);
assert.strictEqual(err.message, 'Max payload size exceeded');
done();
});
});
Expand Down

0 comments on commit bb9c21c

Please sign in to comment.