1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:47:34 +00:00

LibJS: Handle PlainMonthDay in the Calendar.prototype getters

This commit is contained in:
Linus Groh 2021-08-15 01:01:06 +01:00
parent b76bae13fd
commit 0cf526d0c4
3 changed files with 25 additions and 8 deletions

View file

@ -9,3 +9,16 @@ describe("correct behavior", () => {
expect(calendar.month(date)).toBe(7);
});
});
describe("errors", () => {
test("argument must not be a Temporal.PlainMonthDay object", () => {
const calendar = new Temporal.Calendar("iso8601");
const plainMonthDay = new Temporal.PlainMonthDay(7, 6);
expect(() => {
calendar.month(plainMonthDay);
}).toThrowWithMessage(
TypeError,
"Accessing month of PlainMonthDay is ambiguous, use monthCode instead"
);
});
});