0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/parallel/test-zlib-not-string-or-buffer.js
James M Snell 74891412f1 zlib: migrate to internal/errors
PR-URL: https://github.com/nodejs/node/pull/15618
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
2017-10-02 12:36:52 -07:00

20 lines
511 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, or DataView'
}
);
});