Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
zlib: test BrotliCompress throws invalid arg value
  • Loading branch information
RaisinTen committed Oct 28, 2020
commit a9ce812581c24591ea8654b68674830668da92cb
20 changes: 20 additions & 0 deletions test/parallel/test-zlib-invalid-arg-value-brotli-compress.js
Original file line number Diff line number Diff line change
@@ -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'
});