11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ci// Check the error condition testing for passing something other than a string 41cb0ef41Sopenharmony_ci// or buffer. 51cb0ef41Sopenharmony_ci 61cb0ef41Sopenharmony_ciconst common = require('../common'); 71cb0ef41Sopenharmony_ciconst assert = require('assert'); 81cb0ef41Sopenharmony_ciconst zlib = require('zlib'); 91cb0ef41Sopenharmony_ci 101cb0ef41Sopenharmony_ci[ 111cb0ef41Sopenharmony_ci undefined, 121cb0ef41Sopenharmony_ci null, 131cb0ef41Sopenharmony_ci true, 141cb0ef41Sopenharmony_ci false, 151cb0ef41Sopenharmony_ci 0, 161cb0ef41Sopenharmony_ci 1, 171cb0ef41Sopenharmony_ci [1, 2, 3], 181cb0ef41Sopenharmony_ci { foo: 'bar' }, 191cb0ef41Sopenharmony_ci].forEach((input) => { 201cb0ef41Sopenharmony_ci assert.throws( 211cb0ef41Sopenharmony_ci () => zlib.deflateSync(input), 221cb0ef41Sopenharmony_ci { 231cb0ef41Sopenharmony_ci code: 'ERR_INVALID_ARG_TYPE', 241cb0ef41Sopenharmony_ci name: 'TypeError', 251cb0ef41Sopenharmony_ci message: 'The "buffer" argument must be of type string or an instance ' + 261cb0ef41Sopenharmony_ci 'of Buffer, TypedArray, DataView, or ArrayBuffer.' + 271cb0ef41Sopenharmony_ci common.invalidArgTypeHelper(input) 281cb0ef41Sopenharmony_ci } 291cb0ef41Sopenharmony_ci ); 301cb0ef41Sopenharmony_ci}); 31