node/test/parallel/test-stream-transform-flush-data.js
Antoine du Hamel 411ce7ed2e
test: ensure assertions are reached on more tests
PR-URL: https://github.com/nodejs/node/pull/60760
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2025-11-24 22:44:48 +00:00

29 lines
445 B
JavaScript

'use strict';
const common = require('../common');
const assert = require('assert');
const Transform = require('stream').Transform;
const expected = 'asdf';
function _transform(d, e, n) {
n();
}
function _flush(n) {
n(null, expected);
}
const t = new Transform({
transform: _transform,
flush: _flush
});
t.end(Buffer.from('blerg'));
t.on('data', common.mustCall((data) => {
assert.strictEqual(data.toString(), expected);
}));