From 8ddbf273c44f4b7a74dda6c55252c257fff40258 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 1/2] test: improve code coverage in timers --- 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..582510786a008a 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 expedtedError = { + code: 'ERR_INVALID_CALLBACK', + message: 'Callback must be a function' + }; + + [null, true, false, 0, 1, NaN, '', 'foo', {}, Symbol()].forEach((cb) => { + common.expectsError(() => setUnrefTimeout(cb), + expedtedError); + }); +} + // unref pooled timer { let called = false; From a8b3a1768c4b6f1df80341b1add66775e4bebb4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Jos=C3=A9=20Arboleda?= Date: Mon, 25 Feb 2019 23:36:34 -0500 Subject: [PATCH 2/2] test: improve code coverage in timers fix typo --- test/parallel/test-timers-refresh.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-timers-refresh.js b/test/parallel/test-timers-refresh.js index 582510786a008a..dd4332ab32ea70 100644 --- a/test/parallel/test-timers-refresh.js +++ b/test/parallel/test-timers-refresh.js @@ -32,14 +32,14 @@ const { setUnrefTimeout } = require('internal/timers'); // should throw with non-functions { - const expedtedError = { + 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), - expedtedError); + expectedError); }); }