Temporal: Add basic test for PlainDate#toJSON.

This commit is contained in:
Ms2ger 2022-06-13 10:28:41 +02:00 committed by Philip Chimento
parent f9a5a8b29c
commit 194f7426f9
1 changed files with 21 additions and 0 deletions

View File

@ -0,0 +1,21 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.plaindate.prototype.tojson
description: Basic behavior for toJSON
features: [Temporal]
---*/
const tests = [
[new Temporal.PlainDate(1976, 2, 4), "1976-02-04"],
[new Temporal.PlainDate(1976, 11, 18), "1976-11-18"],
];
const options = new Proxy({}, {
get() { throw new Test262Error("should not get properties off argument") }
});
for (const [datetime, expected] of tests) {
assert.sameValue(datetime.toJSON(), expected, "toJSON without argument");
assert.sameValue(datetime.toJSON(options), expected, "toJSON with argument");
}