File: es.date.to-json.js

package info (click to toggle)
node-core-js 3.33.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 18,828 kB
  • sloc: javascript: 87,204; makefile: 13
file content (16 lines) | stat: -rw-r--r-- 486 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
QUnit.test('Date#toJSON', assert => {
  const { toJSON } = Date.prototype;
  assert.isFunction(toJSON);
  assert.arity(toJSON, 1);
  assert.name(toJSON, 'toJSON');
  assert.looksNative(toJSON);
  assert.nonEnumerable(Date.prototype, 'toJSON');
  const date = new Date();
  assert.same(date.toJSON(), date.toISOString(), 'base');
  assert.same(new Date(NaN).toJSON(), null, 'not finite');
  assert.same(toJSON.call({
    toISOString() {
      return 42;
    },
  }), 42, 'generic');
});