Skip to content

Commit

Permalink
test: increase abort logic coverage
Browse files Browse the repository at this point in the history
PR-URL: nodejs#36586
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
shootermv authored and nodejs-github-bot committed Dec 22, 2020
1 parent fc8fcb0 commit 67b9ba9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/parallel/test-fs-promises-readfile.js
Original file line number Diff line number Diff line change
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 67b9ba9

Please sign in to comment.