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