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

LibJS: Remove fallback value for get_offset_nanoseconds_for

This is a normative change in the Temporal spec.

See: 664f02d

Note that the tests are not comprehensive.
This commit is contained in:
Luke Wilde 2021-11-17 09:37:53 +00:00 committed by Linus Groh
parent f1784c9c87
commit 3666d2132b
20 changed files with 140 additions and 15 deletions

View file

@ -46,4 +46,11 @@ describe("errors", () => {
Temporal.ZonedDateTime.prototype.getISOFields.call("foo");
}).toThrowWithMessage(TypeError, "Not an object of type Temporal.ZonedDateTime");
});
test("custom time zone doesn't have a getOffsetNanosecondsFor function", () => {
const zonedDateTime = new Temporal.ZonedDateTime(0n, {});
expect(() => {
zonedDateTime.getISOFields();
}).toThrowWithMessage(TypeError, "null is not a function");
});
});

View file

@ -18,4 +18,11 @@ describe("errors", () => {
Reflect.get(Temporal.ZonedDateTime.prototype, "offset", "foo");
}).toThrowWithMessage(TypeError, "Not an object of type Temporal.ZonedDateTime");
});
test("custom time zone doesn't have a getOffsetNanosecondsFor function", () => {
const zonedDateTime = new Temporal.ZonedDateTime(0n, {});
expect(() => {
zonedDateTime.offset;
}).toThrowWithMessage(TypeError, "null is not a function");
});
});

View file

@ -18,4 +18,11 @@ describe("errors", () => {
Reflect.get(Temporal.ZonedDateTime.prototype, "offsetNanoseconds", "foo");
}).toThrowWithMessage(TypeError, "Not an object of type Temporal.ZonedDateTime");
});
test("custom time zone doesn't have a getOffsetNanosecondsFor function", () => {
const zonedDateTime = new Temporal.ZonedDateTime(0n, {});
expect(() => {
zonedDateTime.offsetNanoseconds;
}).toThrowWithMessage(TypeError, "null is not a function");
});
});

View file

@ -17,4 +17,11 @@ describe("errors", () => {
Temporal.ZonedDateTime.prototype.toJSON.call("foo");
}).toThrowWithMessage(TypeError, "Not an object of type Temporal.ZonedDateTime");
});
test("custom time zone doesn't have a getOffsetNanosecondsFor function", () => {
const zonedDateTime = new Temporal.ZonedDateTime(0n, {});
expect(() => {
zonedDateTime.toJSON();
}).toThrowWithMessage(TypeError, "null is not a function");
});
});

View file

@ -17,4 +17,11 @@ describe("errors", () => {
Temporal.ZonedDateTime.prototype.toLocaleString.call("foo");
}).toThrowWithMessage(TypeError, "Not an object of type Temporal.ZonedDateTime");
});
test("custom time zone doesn't have a getOffsetNanosecondsFor function", () => {
const zonedDateTime = new Temporal.ZonedDateTime(0n, {});
expect(() => {
zonedDateTime.toLocaleString();
}).toThrowWithMessage(TypeError, "null is not a function");
});
});

View file

@ -96,4 +96,11 @@ describe("errors", () => {
Temporal.ZonedDateTime.prototype.toString.call("foo");
}).toThrowWithMessage(TypeError, "Not an object of type Temporal.ZonedDateTime");
});
test("custom time zone doesn't have a getOffsetNanosecondsFor function", () => {
const zonedDateTime = new Temporal.ZonedDateTime(0n, {});
expect(() => {
zonedDateTime.toString();
}).toThrowWithMessage(TypeError, "null is not a function");
});
});