From f59e2256752e257c2eb28bf4109162f1eaae559a Mon Sep 17 00:00:00 2001 From: raisinten Date: Tue, 27 Oct 2020 21:30:24 +0530 Subject: [PATCH] zlib: test BrotliCompress throws invalid arg value PR-URL: https://github.com/nodejs/node/pull/35830 Reviewed-By: Rich Trott Reviewed-By: Luigi Pinca Reviewed-By: Ricky Zhou <0x19951125@gmail.com> --- ...-zlib-invalid-arg-value-brotli-compress.js | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 test/parallel/test-zlib-invalid-arg-value-brotli-compress.js diff --git a/test/parallel/test-zlib-invalid-arg-value-brotli-compress.js b/test/parallel/test-zlib-invalid-arg-value-brotli-compress.js new file mode 100644 index 00000000000000..688acddd16a136 --- /dev/null +++ b/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' +});