0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-21 21:19:50 +01:00
nodejs/test/parallel/test-zlib-object-write.js
Robert Nagy 1f209129c7 stream: throw invalid argument errors
Logic errors that do not depend on stream
state should throw instead of invoke callback
and emit error.

PR-URL: https://github.com/nodejs/node/pull/31831
Refs: https://github.com/nodejs/node/pull/31818
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-02-25 12:07:30 +01:00

15 lines
317 B
JavaScript

'use strict';
const common = require('../common');
const assert = require('assert');
const { Gunzip } = require('zlib');
const gunzip = new Gunzip({ objectMode: true });
gunzip.on('error', common.mustNotCall());
assert.throws(() => {
gunzip.write({});
}, {
name: 'TypeError',
code: 'ERR_INVALID_ARG_TYPE'
});