You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
'use strict';
|
|
|
|
require('../common');
|
|
|
|
const zlib = require('zlib');
|
|
|
|
const assert = require('assert');
|
|
|
|
|
|
|
|
const shouldNotBeCalled = () => { throw new Error('unexpected event'); };
|
|
|
|
|
|
|
|
const message = 'Come on, Fhqwhgads.';
|
|
|
|
|
|
|
|
const zipper = new zlib.Gzip();
|
|
|
|
zipper.on('close', shouldNotBeCalled);
|
|
|
|
|
|
|
|
const buffer = new Buffer(message);
|
|
|
|
const zipped = zipper._processChunk(buffer, zlib.constants.Z_FINISH);
|
|
|
|
|
|
|
|
const unzipper = new zlib.Gunzip();
|
|
|
|
unzipper.on('close', shouldNotBeCalled);
|
|
|
|
|
|
|
|
const unzipped = unzipper._processChunk(zipped, zlib.constants.Z_FINISH);
|
|
|
|
assert.notEqual(zipped.toString(), message);
|
|
|
|
assert.strictEqual(unzipped.toString(), message);
|