mirror of https://github.com/lukechilds/node.git
Browse Source
Add a test for _writableState.finished. PR-URL: https://github.com/nodejs/node/pull/8791 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Related: https://github.com/nodejs/node/issues/8686v7.x
Italo A. Casas
8 years ago
committed by
Evan Lucas
1 changed files with 22 additions and 0 deletions
@ -0,0 +1,22 @@ |
|||
'use strict'; |
|||
|
|||
const common = require('../common'); |
|||
|
|||
const assert = require('assert'); |
|||
const stream = require('stream'); |
|||
|
|||
const writable = new stream.Writable(); |
|||
|
|||
writable._write = (chunk, encoding, cb) => { |
|||
// The state finished should start in false.
|
|||
assert.strictEqual(writable._writableState.finished, false); |
|||
cb(); |
|||
}; |
|||
|
|||
writable.on('finish', common.mustCall(() => { |
|||
assert.strictEqual(writable._writableState.finished, true); |
|||
})); |
|||
|
|||
writable.end('testing finished state', common.mustCall(() => { |
|||
assert.strictEqual(writable._writableState.finished, true); |
|||
})); |
Loading…
Reference in new issue