11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_cirequire('../common');
31cb0ef41Sopenharmony_ciconst assert = require('assert');
41cb0ef41Sopenharmony_ciconst zlib = require('zlib');
51cb0ef41Sopenharmony_ci
61cb0ef41Sopenharmony_cizlib.createGzip({ flush: zlib.constants.Z_SYNC_FLUSH });
71cb0ef41Sopenharmony_ci
81cb0ef41Sopenharmony_ciassert.throws(
91cb0ef41Sopenharmony_ci  () => zlib.createGzip({ flush: 'foobar' }),
101cb0ef41Sopenharmony_ci  {
111cb0ef41Sopenharmony_ci    code: 'ERR_INVALID_ARG_TYPE',
121cb0ef41Sopenharmony_ci    name: 'TypeError',
131cb0ef41Sopenharmony_ci    message: 'The "options.flush" property must be of type number. ' +
141cb0ef41Sopenharmony_ci             "Received type string ('foobar')"
151cb0ef41Sopenharmony_ci  }
161cb0ef41Sopenharmony_ci);
171cb0ef41Sopenharmony_ci
181cb0ef41Sopenharmony_ciassert.throws(
191cb0ef41Sopenharmony_ci  () => zlib.createGzip({ flush: 10000 }),
201cb0ef41Sopenharmony_ci  {
211cb0ef41Sopenharmony_ci    code: 'ERR_OUT_OF_RANGE',
221cb0ef41Sopenharmony_ci    name: 'RangeError',
231cb0ef41Sopenharmony_ci    message: 'The value of "options.flush" is out of range. It must ' +
241cb0ef41Sopenharmony_ci             'be >= 0 and <= 5. Received 10000'
251cb0ef41Sopenharmony_ci  }
261cb0ef41Sopenharmony_ci);
271cb0ef41Sopenharmony_ci
281cb0ef41Sopenharmony_cizlib.createGzip({ finishFlush: zlib.constants.Z_SYNC_FLUSH });
291cb0ef41Sopenharmony_ci
301cb0ef41Sopenharmony_ciassert.throws(
311cb0ef41Sopenharmony_ci  () => zlib.createGzip({ finishFlush: 'foobar' }),
321cb0ef41Sopenharmony_ci  {
331cb0ef41Sopenharmony_ci    code: 'ERR_INVALID_ARG_TYPE',
341cb0ef41Sopenharmony_ci    name: 'TypeError',
351cb0ef41Sopenharmony_ci    message: 'The "options.finishFlush" property must be of type number. ' +
361cb0ef41Sopenharmony_ci             "Received type string ('foobar')"
371cb0ef41Sopenharmony_ci  }
381cb0ef41Sopenharmony_ci);
391cb0ef41Sopenharmony_ci
401cb0ef41Sopenharmony_ciassert.throws(
411cb0ef41Sopenharmony_ci  () => zlib.createGzip({ finishFlush: 10000 }),
421cb0ef41Sopenharmony_ci  {
431cb0ef41Sopenharmony_ci    code: 'ERR_OUT_OF_RANGE',
441cb0ef41Sopenharmony_ci    name: 'RangeError',
451cb0ef41Sopenharmony_ci    message: 'The value of "options.finishFlush" is out of range. It must ' +
461cb0ef41Sopenharmony_ci             'be >= 0 and <= 5. Received 10000'
471cb0ef41Sopenharmony_ci  }
481cb0ef41Sopenharmony_ci);
49