Skip to content

Commit ee96946

Browse files
juanarbolBethGriggs
authored andcommitted
test: improve code coverage in timers
PR-URL: #26310 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
1 parent 5249a22 commit ee96946

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/parallel/test-timers-refresh.js

+13
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,19 @@ const { setUnrefTimeout } = require('internal/timers');
3030
strictEqual(timer.refresh(), timer);
3131
}
3232

33+
// should throw with non-functions
34+
{
35+
const expectedError = {
36+
code: 'ERR_INVALID_CALLBACK',
37+
message: 'Callback must be a function'
38+
};
39+
40+
[null, true, false, 0, 1, NaN, '', 'foo', {}, Symbol()].forEach((cb) => {
41+
common.expectsError(() => setUnrefTimeout(cb),
42+
expectedError);
43+
});
44+
}
45+
3346
// unref pooled timer
3447
{
3548
let called = false;

0 commit comments

Comments
 (0)