1'use strict'; 2 3require('../common'); 4 5const assert = require('assert'); 6const zlib = require('zlib'); 7 8assert.throws( 9 () => zlib.createGzip({ chunkSize: 0 }), 10 { 11 code: 'ERR_OUT_OF_RANGE', 12 name: 'RangeError', 13 message: 'The value of "options.chunkSize" is out of range. It must ' + 14 'be >= 64. Received 0' 15 } 16); 17 18assert.throws( 19 () => zlib.createGzip({ windowBits: 0 }), 20 { 21 code: 'ERR_OUT_OF_RANGE', 22 name: 'RangeError', 23 message: 'The value of "options.windowBits" is out of range. It must ' + 24 'be >= 9 and <= 15. Received 0' 25 } 26); 27 28assert.throws( 29 () => zlib.createGzip({ memLevel: 0 }), 30 { 31 code: 'ERR_OUT_OF_RANGE', 32 name: 'RangeError', 33 message: 'The value of "options.memLevel" is out of range. It must ' + 34 'be >= 1 and <= 9. Received 0' 35 } 36); 37 38{ 39 const stream = zlib.createGzip({ level: NaN }); 40 assert.strictEqual(stream._level, zlib.constants.Z_DEFAULT_COMPRESSION); 41} 42 43{ 44 const stream = zlib.createGzip({ strategy: NaN }); 45 assert.strictEqual(stream._strategy, zlib.constants.Z_DEFAULT_STRATEGY); 46} 47