Skip to content

Commit 01576fb

Browse files
shootermvtargos
authored andcommitted
test: increase abort logic coverage
PR-URL: #36586 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent ecbb757 commit 01576fb

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/parallel/test-fs-promises-readfile.js

+12
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,22 @@ function validateReadFileAbortLogicDuring() {
6060
});
6161
}
6262

63+
async function validateWrongSignalParam() {
64+
// Verify that if something different than Abortcontroller.signal
65+
// is passed, ERR_INVALID_ARG_TYPE is thrown
66+
67+
await assert.rejects(async () => {
68+
const callback = common.mustNotCall(() => {});
69+
await readFile(fn, { signal: 'hello' }, callback);
70+
}, { code: 'ERR_INVALID_ARG_TYPE', name: 'TypeError' });
71+
72+
}
73+
6374
(async () => {
6475
await createLargeFile();
6576
await validateReadFile();
6677
await validateReadFileProc();
6778
await validateReadFileAbortLogicBefore();
6879
await validateReadFileAbortLogicDuring();
80+
await validateWrongSignalParam();
6981
})().then(common.mustCall());

0 commit comments

Comments
 (0)