mirror of
https://github.com/nodejs/node.git
synced 2025-05-10 03:12:57 +00:00

PR-URL: https://github.com/nodejs/node/pull/13686 Fixes: https://github.com/nodejs/node/issues/13682 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
30 lines
583 B
JavaScript
30 lines
583 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const fs = require('fs');
|
|
const assert = require('assert');
|
|
|
|
[Infinity, -Infinity, NaN].forEach((input) => {
|
|
common.expectsError(
|
|
() => {
|
|
fs._toUnixTimestamp(input);
|
|
},
|
|
{
|
|
code: 'ERR_INVALID_ARG_TYPE',
|
|
type: TypeError
|
|
});
|
|
});
|
|
|
|
common.expectsError(
|
|
() => {
|
|
fs._toUnixTimestamp({});
|
|
},
|
|
{
|
|
code: 'ERR_INVALID_ARG_TYPE',
|
|
type: TypeError
|
|
});
|
|
|
|
const okInputs = [1, -1, '1', '-1', Date.now()];
|
|
okInputs.forEach((input) => {
|
|
assert.doesNotThrow(() => fs._toUnixTimestamp(input));
|
|
});
|