• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2
3const common = require('../common');
4
5const assert = require('assert');
6const stream = require('stream');
7
8const writable = new stream.Writable();
9
10writable._write = (chunk, encoding, cb) => {
11  // The state finished should start in false.
12  assert.strictEqual(writable._writableState.finished, false);
13  cb();
14};
15
16writable.on('finish', common.mustCall(() => {
17  assert.strictEqual(writable._writableState.finished, true);
18}));
19
20writable.end('testing finished state', common.mustCall(() => {
21  assert.strictEqual(writable._writableState.finished, true);
22}));
23