From ee9694668b9afeff15e42f38ffc805970c05492e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Jos=C3=A9=20Arboleda?= Date: Mon, 25 Feb 2019 21:50:00 -0500 Subject: [PATCH] test: improve code coverage in timers PR-URL: https://github.com/nodejs/node/pull/26310 Reviewed-By: James M Snell Reviewed-By: Sakthipriyan Vairamani Reviewed-By: Luigi Pinca Reviewed-By: Ruben Bridgewater --- test/parallel/test-timers-refresh.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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;