zlib: test BrotliCompress throws invalid arg value

PR-URL: https://github.com/nodejs/node/pull/35830
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ricky Zhou <0x19951125@gmail.com>
This commit is contained in:
raisinten authored and Beth Griggs committed 2020-12-15 20:15:06 +00:00
1 parent 1cb50c17d3
commit f59e225675
1 file changed
+20
@@ -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'
});