LibJS: Implement parsing of TemporalInstantString

This commit is contained in:
Linus Groh 2021-11-20 16:50:56 +00:00
commit 783222f87a
Notes: sideshowbarker 2024-07-18 00:56:06 +09:00
5 changed files with 42 additions and 5 deletions

View file

@ -14,10 +14,17 @@ describe("correct behavior", () => {
expect(Temporal.Instant.from(zonedDateTime).epochNanoseconds).toBe(123n);
});
// Un-skip once ParseISODateTime & ParseTemporalTimeZoneString are implemented
test.skip("Instant string argument", () => {
test("Instant string argument", () => {
expect(Temporal.Instant.from("1975-02-02T14:25:36.123456789Z").epochNanoseconds).toBe(
160583136123456789n
);
});
});
describe("errors", () => {
test("invalid instant string", () => {
expect(() => {
Temporal.Instant.from("foo");
}).toThrowWithMessage(RangeError, "Invalid instant string 'foo'");
});
});