Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
tests: fix transform async iterator test
  • Loading branch information
David Mark Clements committed Jul 12, 2019
commit 6382470b37dcf1eb5c657ad65a253a28fd3cb6b1
16 changes: 10 additions & 6 deletions test/parallel/test-stream-readable-async-iterators.js
Original file line number Diff line number Diff line change
Expand Up @@ -396,24 +396,28 @@ async function tests() {
}
}

console.log('readable side of a transform stream pushes null');
{
Comment thread
davidmarkclements marked this conversation as resolved.
console.log('readable side of a transform stream pushes null');
const transform = new Transform({
objectMode: true,
transform: common.mustNotCall()
transform: (chunk, enc, cb) => { cb(null, chunk); }
});
transform.push(0);
transform.push(1);
transform.push(null);
const mustReach = common.mustCall();
process.nextTick(() => {
transform.push(null);
});

const mustReach = [ common.mustCall(), common.mustCall() ];

const iter = transform[Symbol.asyncIterator]();
assert.strictEqual((await iter.next()).value, 0);

for await (const d of iter) {
assert.strictEqual(d, 1);
Comment thread
davidmarkclements marked this conversation as resolved.
mustReach[0]();
}

mustReach();
mustReach[1]();
}

{
Expand Down