From 102d7dfe0281d7174872291cebbd7309d5fb785f 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' +});