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/12223 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
21 lines
836 B
JavaScript
21 lines
836 B
JavaScript
'use strict';
|
|
|
|
// Check the error condition testing for passing something other than a string
|
|
// or buffer.
|
|
|
|
require('../common');
|
|
const assert = require('assert');
|
|
const zlib = require('zlib');
|
|
|
|
const expected = new RegExp('^TypeError: "buffer" argument must be a string, ' +
|
|
'Buffer, TypedArray, or DataView$');
|
|
|
|
assert.throws(() => { zlib.deflateSync(undefined); }, expected);
|
|
assert.throws(() => { zlib.deflateSync(null); }, expected);
|
|
assert.throws(() => { zlib.deflateSync(true); }, expected);
|
|
assert.throws(() => { zlib.deflateSync(false); }, expected);
|
|
assert.throws(() => { zlib.deflateSync(0); }, expected);
|
|
assert.throws(() => { zlib.deflateSync(1); }, expected);
|
|
assert.throws(() => { zlib.deflateSync([1, 2, 3]); }, expected);
|
|
assert.throws(() => { zlib.deflateSync({foo: 'bar'}); }, expected);
|