Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

zlib: test BrotliCompress throws invalid arg value #35830

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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'
});