Skip to content

Commit c543f4a

Browse files
italoacasasMylesBorins
authored andcommitted
test: stream writable ended state
PR-URL: #8778 Ref: #8686 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent f46a04c commit c543f4a

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
'use strict';
2+
3+
const common = require('../common');
4+
5+
const assert = require('assert');
6+
const stream = require('stream');
7+
8+
const writable = new stream.Writable();
9+
10+
writable._write = (chunk, encoding, cb) => {
11+
assert.strictEqual(writable._writableState.ended, false);
12+
cb();
13+
};
14+
15+
assert.strictEqual(writable._writableState.ended, false);
16+
17+
writable.end('testing ended state', common.mustCall(() => {
18+
assert.strictEqual(writable._writableState.ended, true);
19+
}));
20+
21+
assert.strictEqual(writable._writableState.ended, true);

0 commit comments

Comments
 (0)