• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2require('../common');
3const assert = require('assert');
4const fs = require('fs');
5
6[Infinity, -Infinity, NaN].forEach((input) => {
7  assert.throws(
8    () => {
9      fs._toUnixTimestamp(input);
10    },
11    {
12      code: 'ERR_INVALID_ARG_TYPE',
13      name: 'TypeError'
14    });
15});
16
17assert.throws(
18  () => {
19    fs._toUnixTimestamp({});
20  },
21  {
22    code: 'ERR_INVALID_ARG_TYPE',
23    name: 'TypeError'
24  });
25
26const okInputs = [1, -1, '1', '-1', Date.now()];
27okInputs.forEach((input) => {
28  fs._toUnixTimestamp(input);
29});
30