mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 21:57:35 +00:00
LibJS: Only allow Calendar this value in Temporal.Calendar#toJSON
This is a normative change in the Temporal spec.
See: 2644fc6
This commit is contained in:
parent
5277646f46
commit
803e96f0c5
2 changed files with 10 additions and 5 deletions
|
@ -7,8 +7,12 @@ describe("correct behavior", () => {
|
|||
const calendar = new Temporal.Calendar("iso8601");
|
||||
expect(calendar.toJSON()).toBe("iso8601");
|
||||
});
|
||||
});
|
||||
|
||||
test("works with any this value", () => {
|
||||
expect(Temporal.Calendar.prototype.toJSON.call("foo")).toBe("foo");
|
||||
describe("errors", () => {
|
||||
test("this value must be a Temporal.Calendar object", () => {
|
||||
expect(() => {
|
||||
Temporal.Calendar.prototype.toJSON.call("foo");
|
||||
}).toThrowWithMessage(TypeError, "Not an object of type Temporal.Calendar");
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue