11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_cirequire('../common'); 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_ciconst assert = require('assert'); 61cb0ef41Sopenharmony_ciconst zlib = require('zlib'); 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_ciassert.throws( 91cb0ef41Sopenharmony_ci () => zlib.createGzip({ chunkSize: 0 }), 101cb0ef41Sopenharmony_ci { 111cb0ef41Sopenharmony_ci code: 'ERR_OUT_OF_RANGE', 121cb0ef41Sopenharmony_ci name: 'RangeError', 131cb0ef41Sopenharmony_ci message: 'The value of "options.chunkSize" is out of range. It must ' + 141cb0ef41Sopenharmony_ci 'be >= 64. Received 0' 151cb0ef41Sopenharmony_ci } 161cb0ef41Sopenharmony_ci); 171cb0ef41Sopenharmony_ci 181cb0ef41Sopenharmony_ciassert.throws( 191cb0ef41Sopenharmony_ci () => zlib.createGzip({ windowBits: 0 }), 201cb0ef41Sopenharmony_ci { 211cb0ef41Sopenharmony_ci code: 'ERR_OUT_OF_RANGE', 221cb0ef41Sopenharmony_ci name: 'RangeError', 231cb0ef41Sopenharmony_ci message: 'The value of "options.windowBits" is out of range. It must ' + 241cb0ef41Sopenharmony_ci 'be >= 9 and <= 15. Received 0' 251cb0ef41Sopenharmony_ci } 261cb0ef41Sopenharmony_ci); 271cb0ef41Sopenharmony_ci 281cb0ef41Sopenharmony_ciassert.throws( 291cb0ef41Sopenharmony_ci () => zlib.createGzip({ memLevel: 0 }), 301cb0ef41Sopenharmony_ci { 311cb0ef41Sopenharmony_ci code: 'ERR_OUT_OF_RANGE', 321cb0ef41Sopenharmony_ci name: 'RangeError', 331cb0ef41Sopenharmony_ci message: 'The value of "options.memLevel" is out of range. It must ' + 341cb0ef41Sopenharmony_ci 'be >= 1 and <= 9. Received 0' 351cb0ef41Sopenharmony_ci } 361cb0ef41Sopenharmony_ci); 371cb0ef41Sopenharmony_ci 381cb0ef41Sopenharmony_ci{ 391cb0ef41Sopenharmony_ci const stream = zlib.createGzip({ level: NaN }); 401cb0ef41Sopenharmony_ci assert.strictEqual(stream._level, zlib.constants.Z_DEFAULT_COMPRESSION); 411cb0ef41Sopenharmony_ci} 421cb0ef41Sopenharmony_ci 431cb0ef41Sopenharmony_ci{ 441cb0ef41Sopenharmony_ci const stream = zlib.createGzip({ strategy: NaN }); 451cb0ef41Sopenharmony_ci assert.strictEqual(stream._strategy, zlib.constants.Z_DEFAULT_STRATEGY); 461cb0ef41Sopenharmony_ci} 47