Skip to content

Commit

Permalink
test: stream writable ended state
Browse files Browse the repository at this point in the history
PR-URL: #8778
Ref: #8686
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
italoacasas authored and rvagg committed Oct 18, 2016
1 parent 017a058 commit 5e5d034
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/parallel/test-stream-writable-ended-state.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
'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);
cb();
};

assert.strictEqual(writable._writableState.ended, false);

writable.end('testing ended state', common.mustCall(() => {
assert.strictEqual(writable._writableState.ended, true);
}));

assert.strictEqual(writable._writableState.ended, true);

0 comments on commit 5e5d034

Please sign in to comment.