mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 22:47:44 +00:00
LibJS: Implement Temporal.PlainYearMonth.prototype.toLocaleString()
This commit is contained in:
parent
421ad73b4f
commit
70fb7bf57e
4 changed files with 44 additions and 0 deletions
|
@ -0,0 +1,23 @@
|
|||
describe("correct behavior", () => {
|
||||
test("length is 0", () => {
|
||||
expect(Temporal.PlainYearMonth.prototype.toLocaleString).toHaveLength(0);
|
||||
});
|
||||
|
||||
test("basic functionality", () => {
|
||||
let plainYearMonth;
|
||||
|
||||
plainYearMonth = new Temporal.PlainYearMonth(2021, 7);
|
||||
expect(plainYearMonth.toLocaleString()).toBe("2021-07");
|
||||
|
||||
plainYearMonth = new Temporal.PlainYearMonth(2021, 7, { toString: () => "foo" }, 6);
|
||||
expect(plainYearMonth.toLocaleString()).toBe("2021-07-06[u-ca=foo]");
|
||||
});
|
||||
});
|
||||
|
||||
describe("errors", () => {
|
||||
test("this value must be a Temporal.PlainYearMonth object", () => {
|
||||
expect(() => {
|
||||
Temporal.PlainYearMonth.prototype.toLocaleString.call("foo");
|
||||
}).toThrowWithMessage(TypeError, "Not a Temporal.PlainYearMonth");
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue