Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
zlib: test BrotliCompress throws invalid arg value
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 BethGriggs committed Dec 15, 2020
1 parent 1cb50c1 commit f59e225
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
@@ -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 f59e225

Please sign in to comment.