1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 15:47:45 +00:00

LibJS: Implement Temporal.PlainYearMonth.compare

This commit is contained in:
Luke Wilde 2021-09-09 04:57:08 +01:00 committed by Linus Groh
parent 092ec0cecf
commit 90ada407db
3 changed files with 35 additions and 0 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);
});
});