mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 21:19:50 +01:00
85c6fcd1cd
A remainder from a previous refactoring. Refs: https://github.com/nodejs/node/pull/31197 PR-URL: https://github.com/nodejs/node/pull/31805 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
33 lines
1.1 KiB
JavaScript
33 lines
1.1 KiB
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
|
|
const assert = require('assert');
|
|
const stream = require('stream');
|
|
|
|
const writable = new stream.Writable();
|
|
|
|
writable._write = (chunk, encoding, cb) => {
|
|
assert.strictEqual(writable._writableState.ended, false);
|
|
assert.strictEqual(writable._writableState.writable, undefined);
|
|
assert.strictEqual(writable.writableEnded, false);
|
|
cb();
|
|
};
|
|
|
|
assert.strictEqual(writable._writableState.ended, false);
|
|
assert.strictEqual(writable._writableState.writable, undefined);
|
|
assert.strictEqual(writable.writable, true);
|
|
assert.strictEqual(writable.writableEnded, false);
|
|
|
|
writable.end('testing ended state', common.mustCall(() => {
|
|
assert.strictEqual(writable._writableState.ended, true);
|
|
assert.strictEqual(writable._writableState.writable, undefined);
|
|
assert.strictEqual(writable.writable, false);
|
|
assert.strictEqual(writable.writableEnded, true);
|
|
}));
|
|
|
|
assert.strictEqual(writable._writableState.ended, true);
|
|
assert.strictEqual(writable._writableState.writable, undefined);
|
|
assert.strictEqual(writable.writable, false);
|
|
assert.strictEqual(writable.writableEnded, true);
|