From 01576fbc19ef424afec9d05b7f44fde239dab457 Mon Sep 17 00:00:00 2001 From: Moshe vilner Date: Fri, 18 Dec 2020 11:52:23 +0200 Subject: [PATCH] test: increase abort logic coverage PR-URL: https://github.com/nodejs/node/pull/36586 Reviewed-By: Benjamin Gruenbaum Reviewed-By: Rich Trott --- test/parallel/test-fs-promises-readfile.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/parallel/test-fs-promises-readfile.js b/test/parallel/test-fs-promises-readfile.js index 93729153ff3019..d1c79580b835b6 100644 --- a/test/parallel/test-fs-promises-readfile.js +++ b/test/parallel/test-fs-promises-readfile.js @@ -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());