1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 09:17:45 +00:00

LibJS: Add yearOfWeek calendar methods and properties

This is a normative change in the Temporal spec.

See:
- 7fa4d18
- caa941d
This commit is contained in:
Luke Wilde 2022-12-26 00:58:43 +00:00 committed by Andreas Kling
parent 804baa42f9
commit fa1416987a
15 changed files with 294 additions and 126 deletions

View file

@ -0,0 +1,19 @@
describe("correct behavior", () => {
test("length is 1", () => {
expect(Temporal.Calendar.prototype.yearOfWeek).toHaveLength(1);
});
test("basic functionality", () => {
const calendar = new Temporal.Calendar("iso8601");
const date = new Temporal.PlainDate(2023, 1, 1);
expect(calendar.yearOfWeek(date)).toBe(2022);
});
});
describe("errors", () => {
test("this value must be a Temporal.Calendar object", () => {
expect(() => {
Temporal.Calendar.prototype.yearOfWeek.call("foo");
}).toThrowWithMessage(TypeError, "Not an object of type Temporal.Calendar");
});
});