2016-08-30 19:38:32 -07:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
// Check the error condition testing for passing something other than a string
|
|
|
|
// or buffer.
|
|
|
|
|
2017-09-25 16:48:57 -07:00
|
|
|
const common = require('../common');
|
2016-08-30 19:38:32 -07:00
|
|
|
const zlib = require('zlib');
|
|
|
|
|
2017-09-25 16:48:57 -07:00
|
|
|
[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, ' +
|
2017-10-06 12:19:33 -07:00
|
|
|
'TypedArray, DataView, or ArrayBuffer'
|
2017-09-25 16:48:57 -07:00
|
|
|
}
|
|
|
|
);
|
|
|
|
});
|