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

LibJS: Implement Temporal.Calendar.from()

This commit is contained in:
Linus Groh 2021-08-01 11:40:03 +01:00
parent a91848c148
commit dc80a258f6
3 changed files with 35 additions and 0 deletions

View file

@ -0,0 +1,21 @@
describe("normal behavior", () => {
test("length is 1", () => {
expect(Temporal.Calendar.from).toHaveLength(1);
});
test("basic functionality", () => {
const plainDate = new Temporal.PlainDate(1970, 1, 1);
const plainTime = new Temporal.PlainTime();
const plainDateTime = new Temporal.PlainDateTime(1970, 1, 1);
// TODO: PlainMonthDay, PlainYearMonth, ZonedDateTime
const calendarLike = {};
const withCalendarLike = { calendar: {} };
expect(Temporal.Calendar.from(plainDate)).toBe(plainDate.calendar);
expect(Temporal.Calendar.from(plainTime)).toBe(plainTime.calendar);
expect(Temporal.Calendar.from(plainDateTime)).toBe(plainDateTime.calendar);
expect(Temporal.Calendar.from(calendarLike)).toBe(calendarLike);
expect(Temporal.Calendar.from(withCalendarLike)).toBe(withCalendarLike.calendar);
expect(Temporal.Calendar.from("iso8601").id).toBe("iso8601");
// TODO: test Temporal.Calendar.from("TemporalCalendarString") once ParseTemporalCalendarString is working
});
});