mirror of
https://github.com/nodejs/node.git
synced 2025-05-01 08:42:45 +00:00

PR-URL: https://github.com/nodejs/node/pull/30787 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Richard Lau <riclau@uk.ibm.com>
20 lines
455 B
JavaScript
20 lines
455 B
JavaScript
// Flags: --expose-internals
|
|
'use strict';
|
|
require('../common');
|
|
const assert = require('assert');
|
|
const { sleep } = require('internal/util');
|
|
|
|
[undefined, null, '', {}, true, false].forEach((value) => {
|
|
assert.throws(
|
|
() => { sleep(value); },
|
|
/The "msec" argument must be of type number/
|
|
);
|
|
});
|
|
|
|
[-1, 3.14, NaN, 4294967296].forEach((value) => {
|
|
assert.throws(
|
|
() => { sleep(value); },
|
|
/The value of "msec" is out of range/
|
|
);
|
|
});
|