mirror of
https://github.com/nodejs/node.git
synced 2025-05-09 15:46:27 +00:00

PR-URL: https://github.com/nodejs/node/pull/16042 Refs: https://github.com/nodejs/node/issues/1826 Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
20 lines
524 B
JavaScript
20 lines
524 B
JavaScript
'use strict';
|
|
|
|
// Check the error condition testing for passing something other than a string
|
|
// or buffer.
|
|
|
|
const common = require('../common');
|
|
const zlib = require('zlib');
|
|
|
|
[undefined, null, true, false, 0, 1, [1, 2, 3], { foo: 'bar' }].forEach((i) => {
|
|
common.expectsError(
|
|
() => zlib.deflateSync(i),
|
|
{
|
|
code: 'ERR_INVALID_ARG_TYPE',
|
|
type: TypeError,
|
|
message: 'The "buffer" argument must be one of type string, Buffer, ' +
|
|
'TypedArray, DataView, or ArrayBuffer'
|
|
}
|
|
);
|
|
});
|