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

LibJS: Implement Temporal.PlainDateTime.prototype.toLocaleString

This commit is contained in:
Luke Wilde 2021-11-03 01:57:57 +00:00 committed by Linus Groh
parent b2bbd4d2b8
commit 2a98b521b4
3 changed files with 32 additions and 0 deletions

View file

@ -0,0 +1,18 @@
describe("correct behavior", () => {
test("length is 0", () => {
expect(Temporal.PlainDateTime.prototype.toLocaleString).toHaveLength(0);
});
test("basic functionality", () => {
const plainDateTime = new Temporal.PlainDateTime(2021, 11, 3, 1, 33, 5, 100, 200, 300);
expect(plainDateTime.toLocaleString()).toBe("2021-11-03T01:33:05.1002003");
});
});
describe("errors", () => {
test("this value must be a Temporal.PlainDateTime object", () => {
expect(() => {
Temporal.PlainDateTime.prototype.toLocaleString.call("foo");
}).toThrowWithMessage(TypeError, "Not an object of type Temporal.PlainDateTime");
});
});