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

PR-URL: https://github.com/nodejs/node/pull/12735 Refs: https://github.com/nodejs/node/pull/12455 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
18 lines
519 B
JavaScript
18 lines
519 B
JavaScript
'use strict';
|
|
require('../common');
|
|
const fs = require('fs');
|
|
const assert = require('assert');
|
|
|
|
[Infinity, -Infinity, NaN].forEach((input) => {
|
|
assert.throws(() => fs._toUnixTimestamp(input),
|
|
new RegExp(`^Error: Cannot parse time: ${input}$`));
|
|
});
|
|
|
|
assert.throws(() => fs._toUnixTimestamp({}),
|
|
/^Error: Cannot parse time: \[object Object\]$/);
|
|
|
|
const okInputs = [1, -1, '1', '-1', Date.now()];
|
|
okInputs.forEach((input) => {
|
|
assert.doesNotThrow(() => fs._toUnixTimestamp(input));
|
|
});
|