node/test/parallel/test-zlib-invalid-arg-value-brotli-compress.js
raisinten c0af8bdc1c 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>
2020-10-31 06:40:24 +01:00

21 lines
455 B
JavaScript

'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'
});