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 <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
  • Loading branch information
shootermv authored and targos committed May 1, 2021
1 parent c308b06 commit cf8d025
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 @@ -61,10 +61,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 cf8d025

Please sign in to comment.