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

LibJS: Implement Temporal.PlainDate.from

This commit is contained in:
Idan Horowitz 2021-07-26 17:07:59 +03:00 committed by Linus Groh
parent 07485802c6
commit 67b3255fe8
3 changed files with 47 additions and 0 deletions

View file

@ -0,0 +1,21 @@
describe("correct behavior", () => {
test("length is 1", () => {
expect(Temporal.PlainDate.from).toHaveLength(1);
});
test("PlainDate instance argument", () => {
const plainDate = new Temporal.PlainDate(2021, 7, 26);
const createdPlainDate = Temporal.PlainDate.from(plainDate);
expect(createdPlainDate.year).toBe(2021);
expect(createdPlainDate.month).toBe(7);
expect(createdPlainDate.day).toBe(26);
});
// Un-skip once ParseISODateTime & ParseTemporalDateString are implemented
test.skip("PlainDate string argument", () => {
const createdPlainDate = Temporal.PlainDate.from("2021-07-26");
expect(createdPlainDate.year).toBe(2021);
expect(createdPlainDate.month).toBe(7);
expect(createdPlainDate.day).toBe(26);
});
});