Sha256: 166948c39c51cd92b532defd42a7d16cbd0e4530e6e94900d78950c82db37632
Contents?: true
Size: 825 Bytes
Versions: 4
Compression:
Stored size: 825 Bytes
Contents
'use strict'; require('../common'); const assert = require('assert'); const stream = require('stream'); const writable = new stream.Writable(); function testStates(ending, finished, ended) { assert.strictEqual(writable._writableState.ending, ending); assert.strictEqual(writable._writableState.finished, finished); assert.strictEqual(writable._writableState.ended, ended); } writable._write = (chunk, encoding, cb) => { // ending, finished, ended start in false. testStates(false, false, false); cb(); }; writable.on('finish', () => { // ending, finished, ended = true. testStates(true, true, true); }); writable.end('testing function end()', () => { // ending, finished, ended = true. testStates(true, true, true); }); // ending, ended = true. // finished = false. testStates(true, false, true);
Version data entries
4 entries across 4 versions & 1 rubygems