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:
Juan José Arboleda 2019-02-25 21:50:00 -05:00 committed by Ruben Bridgewater
parent f18ae25193
commit 9c1e3a34fe
No known key found for this signature in database
GPG Key ID: F07496B3EB3C1762

View File

@ -30,6 +30,19 @@ const { setUnrefTimeout } = require('internal/timers');
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
{
let called = false;