Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 80a26c7

Browse filesBrowse files
Italo A. CasasMyles Borins
authored andcommitted
test: writable stream finished state
Add a test for _writableState.finished. PR-URL: #8791 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Related: #8686
1 parent f9baa11 commit 80a26c7
Copy full SHA for 80a26c7

File tree

Expand file treeCollapse file tree

1 file changed

+22
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+22
-0
lines changed
Open diff view settings
Collapse file
+22Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+
// The state finished should start in false.
12+
assert.strictEqual(writable._writableState.finished, false);
13+
cb();
14+
};
15+
16+
writable.on('finish', common.mustCall(() => {
17+
assert.strictEqual(writable._writableState.finished, true);
18+
}));
19+
20+
writable.end('testing finished state', common.mustCall(() => {
21+
assert.strictEqual(writable._writableState.finished, true);
22+
}));

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.