Skip to content

Commit

Permalink
test: increase abort logic coverage
Browse files Browse the repository at this point in the history
PR-URL: #36586
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
shootermv authored and targos committed Dec 22, 2020
1 parent ecbb757 commit 01576fb
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/parallel/test-fs-promises-readfile.js
Expand Up @@ -60,10 +60,22 @@ function validateReadFileAbortLogicDuring() {
});
}

async function validateWrongSignalParam() {
// Verify that if something different than Abortcontroller.signal
// is passed, ERR_INVALID_ARG_TYPE is thrown

await assert.rejects(async () => {
const callback = common.mustNotCall(() => {});
await readFile(fn, { signal: 'hello' }, callback);
}, { code: 'ERR_INVALID_ARG_TYPE', name: 'TypeError' });

}

(async () => {
await createLargeFile();
await validateReadFile();
await validateReadFileProc();
await validateReadFileAbortLogicBefore();
await validateReadFileAbortLogicDuring();
await validateWrongSignalParam();
})().then(common.mustCall());

0 comments on commit 01576fb

Please sign in to comment.