1'use strict'; 2 3// Check the error condition testing for passing something other than a string 4// or buffer. 5 6const common = require('../common'); 7const assert = require('assert'); 8const zlib = require('zlib'); 9 10[ 11 undefined, 12 null, 13 true, 14 false, 15 0, 16 1, 17 [1, 2, 3], 18 { foo: 'bar' }, 19].forEach((input) => { 20 assert.throws( 21 () => zlib.deflateSync(input), 22 { 23 code: 'ERR_INVALID_ARG_TYPE', 24 name: 'TypeError', 25 message: 'The "buffer" argument must be of type string or an instance ' + 26 'of Buffer, TypedArray, DataView, or ArrayBuffer.' + 27 common.invalidArgTypeHelper(input) 28 } 29 ); 30}); 31