diff --git a/test/parallel/test-timers-refresh.js b/test/parallel/test-timers-refresh.js index 2c47be8d8d15ae..dd4332ab32ea70 100644 --- a/test/parallel/test-timers-refresh.js +++ b/test/parallel/test-timers-refresh.js @@ -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;