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

LibJS: Implement Temporal.ZonedDateTime.prototype.epochMicroseconds

This commit is contained in:
Linus Groh 2021-08-04 23:03:56 +01:00 committed by Andreas Kling
parent a9162b7e98
commit 62294d62c5
3 changed files with 36 additions and 0 deletions

View file

@ -0,0 +1,15 @@
describe("correct behavior", () => {
test("basic functionality", () => {
const timeZone = new Temporal.TimeZone("UTC");
const zonedDateTime = new Temporal.ZonedDateTime(1625614921000000000n, timeZone);
expect(zonedDateTime.epochMicroseconds).toBe(1625614921000000n);
});
});
test("errors", () => {
test("this value must be a Temporal.ZonedDateTime object", () => {
expect(() => {
Reflect.get(Temporal.ZonedDateTime.prototype, "epochMicroseconds", "foo");
}).toThrowWithMessage(TypeError, "Not a Temporal.ZonedDateTime");
});
});