Skip to content

Commit

Permalink
zlib: test BrotliCompress throws invalid arg value
Browse files Browse the repository at this point in the history
PR-URL: #35830
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ricky Zhou <0x19951125@gmail.com>
  • Loading branch information
RaisinTen authored and targos committed Nov 3, 2020
1 parent d16e2fa commit 102d7df
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/parallel/test-zlib-invalid-arg-value-brotli-compress.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
'use strict';

require('../common');

// This test ensures that the BrotliCompress function throws
// ERR_INVALID_ARG_TYPE when the values of the `params` key-value object are
// neither numbers nor booleans.

const assert = require('assert');
const { BrotliCompress, constants } = require('zlib');

const opts = {
params: {
[constants.BROTLI_PARAM_MODE]: 'lol'
}
};

assert.throws(() => BrotliCompress(opts), {
code: 'ERR_INVALID_ARG_TYPE'
});

0 comments on commit 102d7df

Please sign in to comment.