mirror of
https://github.com/nodejs/node.git
synced 2025-05-20 20:44:49 +00:00

PR-URL: https://github.com/nodejs/node/pull/17498 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Jon Moss <me@jonathanmoss.me>
37 lines
598 B
JavaScript
37 lines
598 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const timers = require('timers');
|
|
|
|
[
|
|
{},
|
|
[],
|
|
'foo',
|
|
() => { },
|
|
Symbol('foo')
|
|
].forEach((val) => {
|
|
common.expectsError(
|
|
() => timers.enroll({}, val),
|
|
{
|
|
code: 'ERR_INVALID_ARG_TYPE',
|
|
type: TypeError
|
|
}
|
|
);
|
|
});
|
|
|
|
[
|
|
-1,
|
|
Infinity,
|
|
NaN
|
|
].forEach((val) => {
|
|
common.expectsError(
|
|
() => timers.enroll({}, val),
|
|
{
|
|
code: 'ERR_VALUE_OUT_OF_RANGE',
|
|
type: RangeError,
|
|
message: 'The value of "msecs" must be a non-negative ' +
|
|
`finite number. Received "${val}"`
|
|
}
|
|
);
|
|
});
|