blob: 384ab0ab25790825af84573bdef0de4beb4e3d55 [file] [edit]
'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_OUT_OF_RANGE',
type: RangeError,
message: 'The value of "msecs" is out of range. ' +
'It must be a non-negative finite number. ' +
`Received ${val}`
}
);
});