Skip to content

Commit

Permalink
test: improve code coverage in timers
Browse files Browse the repository at this point in the history
PR-URL: #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>
  • Loading branch information
juanarbol authored and BridgeAR committed Mar 12, 2019
1 parent da457a5 commit dbb7a02
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/parallel/test-timers-refresh.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit dbb7a02

Please sign in to comment.