mirror of
https://github.com/hanzoai/core-js.git
synced 2026-09-24 16:58:15 +00:00
17 lines
486 B
JavaScript
17 lines
486 B
JavaScript
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');
|
|
});
|