• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2
3require('../common');
4const assert = require('assert');
5const timers = require('timers');
6
7[
8  {},
9  [],
10  'foo',
11  () => { },
12  Symbol('foo'),
13].forEach((val) => {
14  assert.throws(
15    () => timers.enroll({}, val),
16    {
17      code: 'ERR_INVALID_ARG_TYPE',
18      name: 'TypeError'
19    }
20  );
21});
22
23[
24  -1,
25  Infinity,
26  NaN,
27].forEach((val) => {
28  assert.throws(
29    () => timers.enroll({}, val),
30    {
31      code: 'ERR_OUT_OF_RANGE',
32      name: 'RangeError',
33      message: 'The value of "msecs" is out of range. ' +
34               'It must be a non-negative finite number. ' +
35               `Received ${val}`
36    }
37  );
38});
39