LibJS: Implement the Temporal.PlainYearMonth constructor

And the simple Temporal.PlainYearMonth.prototype getters, so that the
constructed Temporal.PlainYearMonth may actually be validated.
This commit is contained in:
Timothy Flynn 2024-11-21 11:22:32 -05:00 committed by Andreas Kling
commit b68d67693e
Notes: github-actions[bot] 2024-11-22 18:56:56 +00:00
27 changed files with 926 additions and 3 deletions

View file

@ -0,0 +1,14 @@
describe("correct behavior", () => {
test("length is 2", () => {
expect(Temporal.PlainYearMonth.compare).toHaveLength(2);
});
test("basic functionality", () => {
const plainYearMonth1 = new Temporal.PlainYearMonth(2021, 8);
expect(Temporal.PlainYearMonth.compare(plainYearMonth1, plainYearMonth1)).toBe(0);
const plainYearMonth2 = new Temporal.PlainYearMonth(2021, 9);
expect(Temporal.PlainYearMonth.compare(plainYearMonth2, plainYearMonth2)).toBe(0);
expect(Temporal.PlainYearMonth.compare(plainYearMonth1, plainYearMonth2)).toBe(-1);
expect(Temporal.PlainYearMonth.compare(plainYearMonth2, plainYearMonth1)).toBe(1);
});
});