LibJS: Implement Temporal.Now

This commit is contained in:
Timothy Flynn 2024-11-24 17:23:31 -05:00 committed by Andreas Kling
commit f2c19f96f8
Notes: github-actions[bot] 2024-11-25 12:33:55 +00:00
12 changed files with 252 additions and 0 deletions

View file

@ -0,0 +1,19 @@
describe("correct behavior", () => {
test("length is 0", () => {
expect(Temporal.Now.plainTimeISO).toHaveLength(0);
});
test("basic functionality", () => {
const plainTime = Temporal.Now.plainTimeISO();
expect(plainTime).toBeInstanceOf(Temporal.PlainTime);
expect(plainTime.calendarId).toBeUndefined();
});
});
describe("errors", () => {
test("invalid time zone name", () => {
expect(() => {
Temporal.Now.plainTimeISO("foo");
}).toThrowWithMessage(RangeError, "Invalid time zone name 'foo");
});
});