-
Notifications
You must be signed in to change notification settings - Fork 29.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
zlib: test BrotliCompress throws invalid arg value
- Loading branch information
Showing
1 changed file
with
20 additions
and
0 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
test/parallel/test-zlib-invalid-arg-value-brotli-compress.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | ||
}); |