node/test/parallel/test-zlib-not-string-or-buffer.js
Rich Trott 330f25ef82 test: prepare for consistent comma-dangle lint rule
Make changes so that tests will pass when the comma-dangle settings
applied to the rest of the code base are also applied to tests.

PR-URL: https://github.com/nodejs/node/pull/37930
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is>
2021-04-01 23:14:29 -07:00

31 lines
647 B
JavaScript

'use strict';
// Check the error condition testing for passing something other than a string
// or buffer.
const common = require('../common');
const assert = require('assert');
const zlib = require('zlib');
[
undefined,
null,
true,
false,
0,
1,
[1, 2, 3],
{ foo: 'bar' },
].forEach((input) => {
assert.throws(
() => zlib.deflateSync(input),
{
code: 'ERR_INVALID_ARG_TYPE',
name: 'TypeError',
message: 'The "buffer" argument must be of type string or an instance ' +
'of Buffer, TypedArray, DataView, or ArrayBuffer.' +
common.invalidArgTypeHelper(input)
}
);
});