0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/parallel/test-zlib-sync-no-event.js
cjihrig e5499b32cf test: s/assert.notEqual()/assert.notStrictEqual()/
PR-URL: https://github.com/nodejs/node/pull/10541
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Italo A. Casas <me@italoacasas.com>
2017-01-06 14:08:47 -05:00

22 lines
648 B
JavaScript

'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.notStrictEqual(zipped.toString(), message);
assert.strictEqual(unzipped.toString(), message);