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

LibJS: Implement Temporal.PlainMonthDay.prototype.toLocaleString()

This commit is contained in:
Linus Groh 2021-08-19 08:42:49 +01:00
parent ea44f33d5b
commit 5904c6bf18
3 changed files with 43 additions and 0 deletions

View file

@ -0,0 +1,23 @@
describe("correct behavior", () => {
test("length is 0", () => {
expect(Temporal.PlainMonthDay.prototype.toLocaleString).toHaveLength(0);
});
test("basic functionality", () => {
let plainMonthDay;
plainMonthDay = new Temporal.PlainMonthDay(7, 6);
expect(plainMonthDay.toLocaleString()).toBe("07-06");
plainMonthDay = new Temporal.PlainMonthDay(7, 6, { toString: () => "foo" }, 2021);
expect(plainMonthDay.toLocaleString()).toBe("2021-07-06[u-ca=foo]");
});
});
describe("errors", () => {
test("this value must be a Temporal.PlainMonthDay object", () => {
expect(() => {
Temporal.PlainMonthDay.prototype.toLocaleString.call("foo");
}).toThrowWithMessage(TypeError, "Not a Temporal.PlainMonthDay");
});
});