Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
matthieusieben committed Sep 24, 2024
1 parent 3c5ceff commit 974e666
Showing 1 changed file with 72 additions and 0 deletions.
72 changes: 72 additions & 0 deletions test/parallel/test-stream-duplex-from.js
Original file line number Diff line number Diff line change
Expand Up @@ -401,3 +401,75 @@ function makeATestWritableStream(writeFunc) {
assert.strictEqual(d.writable, false);
}));
}

{
const r = Readable.from(['foo', 'bar', 'baz']);
pipeline(
r,
Duplex.from(async function (asyncGenerator) {

Check failure on line 409 in test/parallel/test-stream-duplex-from.js

View workflow job for this annotation

GitHub Actions / lint-js-and-md

Unexpected space before function parentheses
const res = await asyncGenerator.next();
assert.strictEqual(res.done, false);
assert.strictEqual(res.value.toString(), 'foo');
await asyncGenerator.return();
}),
common.mustCall((err) => {

Check failure on line 415 in test/parallel/test-stream-duplex-from.js

View workflow job for this annotation

GitHub Actions / test-macOS

--- stdout --- Mismatched <anonymous> function calls. Expected exactly 1, actual 0. at Proxy.mustCall (/Users/runner/work/node/node/test/common/index.js:451:10) at Object.<anonymous> (/Users/runner/work/node/node/test/parallel/test-stream-duplex-from.js:415:12) at Module._compile (node:internal/modules/cjs/loader:1557:14) at Object..js (node:internal/modules/cjs/loader:1702:10) at Module.load (node:internal/modules/cjs/loader:1328:32) at Function._load (node:internal/modules/cjs/loader:1138:12) at TracingChannel.traceSync (node:diagnostics_channel:315:14) at wrapModuleLoad (node:internal/modules/cjs/loader:217:24) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:165:5) Mismatched <anonymous> function calls. Expected exactly 1, actual 0. at Proxy.mustCall (/Users/runner/work/node/node/test/common/index.js:451:10) at Object.<anonymous> (/Users/runner/work/node/node/test/parallel/test-stream-duplex-from.js:430:12) at Module._compile (node:internal/modules/cjs/loader:1557:14) at Object..js (node:internal/modules/cjs/loader:1702:10) at Module.load (node:internal/modules/cjs/loader:1328:32) at Function._load (node:internal/modules/cjs/loader:1138:12) at TracingChannel.traceSync (node:diagnostics_channel:315:14) at wrapModuleLoad (node:internal/modules/cjs/loader:217:24) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:165:5) Mismatched <anonymous> function calls. Expected exactly 1, actual 0. at Proxy.mustCall (/Users/runner/work/node/node/test/common/index.js:451:10) at Object.<anonymous> (/Users/runner/work/node/node/test/parallel/test-stream-duplex-from.js:442:12) at Module._compile (node:internal/modules/cjs/loader:1557:14) at Object..js (node:internal/modules/cjs/loader:1702:10) at Module.load (node:internal/modules/cjs/loader:1328:32) at Function._load (node:internal/modules/cjs/loader:1138:12) at TracingChannel.traceSync (node:diagnostics_channel:315:14) at wrapModuleLoad (node:internal/modules/cjs/loader:217:24) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:165:5) Mismatched <anonymous> function calls. Expected exactly 1, actual 0. at Proxy.mustCall (/Users/runner/work/node/node/test/common/index.js:451:10) at Object.<anonymous> (/Users/runner/work/node/node/test/parallel/test-stream-duplex-from.js:470:12) at Module._compile (node:internal/modules/cjs/loader:1557:14) at Object..js (node:internal/modules/cjs/loader:1702:10) at Module.load (node:internal/modules/cjs/loader:1328:32) at Function._load (node:internal/modules/cjs/loader:1138:12) at TracingChannel.traceSync (node:diagnostics_channel:315:14) at wrapModuleLoad (node:internal/modules/cjs/loader:217:24) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:165:5) Command: out/Release/node --test-reporter=spec --test-reporter-destination=stdout --test-reporter=./tools/github_reporter/index.js --test-reporter-destination=stdout /Users/runner/work/node/node/test/parallel/test-stream-duplex-from.js

Check failure on line 415 in test/parallel/test-stream-duplex-from.js

View workflow job for this annotation

GitHub Actions / test-linux

--- stdout --- Mismatched <anonymous> function calls. Expected exactly 1, actual 0. at Proxy.mustCall (/home/runner/work/node/node/test/common/index.js:451:10) at Object.<anonymous> (/home/runner/work/node/node/test/parallel/test-stream-duplex-from.js:415:12) at Module._compile (node:internal/modules/cjs/loader:1557:14) at Object..js (node:internal/modules/cjs/loader:1702:10) at Module.load (node:internal/modules/cjs/loader:1328:32) at Function._load (node:internal/modules/cjs/loader:1138:12) at TracingChannel.traceSync (node:diagnostics_channel:315:14) at wrapModuleLoad (node:internal/modules/cjs/loader:217:24) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:165:5) Mismatched <anonymous> function calls. Expected exactly 1, actual 0. at Proxy.mustCall (/home/runner/work/node/node/test/common/index.js:451:10) at Object.<anonymous> (/home/runner/work/node/node/test/parallel/test-stream-duplex-from.js:430:12) at Module._compile (node:internal/modules/cjs/loader:1557:14) at Object..js (node:internal/modules/cjs/loader:1702:10) at Module.load (node:internal/modules/cjs/loader:1328:32) at Function._load (node:internal/modules/cjs/loader:1138:12) at TracingChannel.traceSync (node:diagnostics_channel:315:14) at wrapModuleLoad (node:internal/modules/cjs/loader:217:24) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:165:5) Mismatched <anonymous> function calls. Expected exactly 1, actual 0. at Proxy.mustCall (/home/runner/work/node/node/test/common/index.js:451:10) at Object.<anonymous> (/home/runner/work/node/node/test/parallel/test-stream-duplex-from.js:442:12) at Module._compile (node:internal/modules/cjs/loader:1557:14) at Object..js (node:internal/modules/cjs/loader:1702:10) at Module.load (node:internal/modules/cjs/loader:1328:32) at Function._load (node:internal/modules/cjs/loader:1138:12) at TracingChannel.traceSync (node:diagnostics_channel:315:14) at wrapModuleLoad (node:internal/modules/cjs/loader:217:24) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:165:5) Mismatched <anonymous> function calls. Expected exactly 1, actual 0. at Proxy.mustCall (/home/runner/work/node/node/test/common/index.js:451:10) at Object.<anonymous> (/home/runner/work/node/node/test/parallel/test-stream-duplex-from.js:470:12) at Module._compile (node:internal/modules/cjs/loader:1557:14) at Object..js (node:internal/modules/cjs/loader:1702:10) at Module.load (node:internal/modules/cjs/loader:1328:32) at Function._load (node:internal/modules/cjs/loader:1138:12) at TracingChannel.traceSync (node:diagnostics_channel:315:14) at wrapModuleLoad (node:internal/modules/cjs/loader:217:24) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:165:5) Command: out/Release/node --test-reporter=spec --test-reporter-destination=stdout --test-reporter=./tools/github_reporter/index.js --test-reporter-destination=stdout /home/runner/work/node/node/test/parallel/test-stream-duplex-from.js

Check failure on line 415 in test/parallel/test-stream-duplex-from.js

View workflow job for this annotation

GitHub Actions / lint-js-and-md

Please use common.mustSucceed instead of common.mustCall with assert.ifError
assert.ifError(err);
assert.strictEqual(r.destroyed, true);
})
);
}

{
const r = Readable.from(['foo', 'bar', 'baz']);
pipeline(
r,
Duplex.from(async function (asyncGenerator) {

Check failure on line 426 in test/parallel/test-stream-duplex-from.js

View workflow job for this annotation

GitHub Actions / lint-js-and-md

Unexpected space before function parentheses
// Note: the generator is not even started at this point
await asyncGenerator.return();
}),
common.mustCall((err) => {

Check failure on line 430 in test/parallel/test-stream-duplex-from.js

View workflow job for this annotation

GitHub Actions / lint-js-and-md

Please use common.mustSucceed instead of common.mustCall with assert.ifError
assert.ifError(err);
assert.strictEqual(r.destroyed, true);
})
);
}

{
const r = Readable.from(['foo', 'bar', 'baz']);
pipeline(
r,
Duplex.from(async function (asyncGenerator) {}),

Check failure on line 441 in test/parallel/test-stream-duplex-from.js

View workflow job for this annotation

GitHub Actions / lint-js-and-md

Unexpected space before function parentheses
common.mustCall((err) => {
assert.strictEqual(err.code, 'ERR_STREAM_PREMATURE_CLOSE');
assert.strictEqual(r.destroyed, true);
})
);
}

{
const r = Readable.from(['foo']);
pipeline(
r,
Duplex.from(async function (asyncGenerator) {

Check failure on line 453 in test/parallel/test-stream-duplex-from.js

View workflow job for this annotation

GitHub Actions / lint-js-and-md

Unexpected space before function parentheses
await asyncGenerator.throw(new Error('my error'));
}),
common.mustCall((err) => {
assert.strictEqual(err.message, 'my error');
assert.strictEqual(r.destroyed, true);
})
);
}

{
const r = Readable.from(['foo', 'bar']);
pipeline(
r,
Duplex.from(async function (asyncGenerator) {

Check failure on line 467 in test/parallel/test-stream-duplex-from.js

View workflow job for this annotation

GitHub Actions / lint-js-and-md

Unexpected space before function parentheses
for await (const _ of asyncGenerator) break;

Check failure on line 468 in test/parallel/test-stream-duplex-from.js

View workflow job for this annotation

GitHub Actions / lint-js-and-md

'_' is assigned a value but never used
}),
common.mustCall((err) => {

Check failure on line 470 in test/parallel/test-stream-duplex-from.js

View workflow job for this annotation

GitHub Actions / lint-js-and-md

Please use common.mustSucceed instead of common.mustCall with assert.ifError
assert.ifError(err);
assert.strictEqual(r.destroyed, true);
})
);
}

0 comments on commit 974e666

Please sign in to comment.