test: improve code coverage in timers
PR-URL: https://github.com/nodejs/node/pull/26310 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This commit is contained in:
parent
f18ae25193
commit
9c1e3a34fe
@ -30,6 +30,19 @@ const { setUnrefTimeout } = require('internal/timers');
|
|||||||
strictEqual(timer.refresh(), timer);
|
strictEqual(timer.refresh(), timer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// should throw with non-functions
|
||||||
|
{
|
||||||
|
const expectedError = {
|
||||||
|
code: 'ERR_INVALID_CALLBACK',
|
||||||
|
message: 'Callback must be a function'
|
||||||
|
};
|
||||||
|
|
||||||
|
[null, true, false, 0, 1, NaN, '', 'foo', {}, Symbol()].forEach((cb) => {
|
||||||
|
common.expectsError(() => setUnrefTimeout(cb),
|
||||||
|
expectedError);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// unref pooled timer
|
// unref pooled timer
|
||||||
{
|
{
|
||||||
let called = false;
|
let called = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user