mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:57:44 +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:
parent
f1784c9c87
commit
3666d2132b
20 changed files with 140 additions and 15 deletions
|
@ -93,4 +93,12 @@ describe("errors", () => {
|
|||
"A starting point is required for balancing calendar units"
|
||||
);
|
||||
});
|
||||
|
||||
test("custom time zone doesn't have a getOffsetNanosecondsFor function", () => {
|
||||
const zonedDateTime = new Temporal.ZonedDateTime(0n, {});
|
||||
const duration = new Temporal.Duration();
|
||||
expect(() => {
|
||||
Temporal.Duration.compare(duration, duration, { relativeTo: zonedDateTime });
|
||||
}).toThrowWithMessage(TypeError, "null is not a function");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -62,4 +62,11 @@ describe("errors", () => {
|
|||
Temporal.Instant.prototype.toString.call("foo");
|
||||
}).toThrowWithMessage(TypeError, "Not an object of type Temporal.Instant");
|
||||
});
|
||||
|
||||
test("custom time zone doesn't have a getOffsetNanosecondsFor function", () => {
|
||||
const instant = new Temporal.Instant(0n);
|
||||
expect(() => {
|
||||
instant.toString({ timeZone: {} });
|
||||
}).toThrowWithMessage(TypeError, "null is not a function");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -35,3 +35,11 @@ describe("correct behavior", () => {
|
|||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe("errors", () => {
|
||||
test("custom time zone doesn't have a getOffsetNanosecondsFor function", () => {
|
||||
expect(() => {
|
||||
Temporal.Now.plainDate({}, {});
|
||||
}).toThrowWithMessage(TypeError, "null is not a function");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -33,3 +33,11 @@ describe("correct behavior", () => {
|
|||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe("errors", () => {
|
||||
test("custom time zone doesn't have a getOffsetNanosecondsFor function", () => {
|
||||
expect(() => {
|
||||
Temporal.Now.plainDateISO({});
|
||||
}).toThrowWithMessage(TypeError, "null is not a function");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -37,3 +37,11 @@ describe("correct behavior", () => {
|
|||
expect(Math.floor(differenceSeconds)).toBe(86400);
|
||||
});
|
||||
});
|
||||
|
||||
describe("errors", () => {
|
||||
test("custom time zone doesn't have a getOffsetNanosecondsFor function", () => {
|
||||
expect(() => {
|
||||
Temporal.Now.plainDateTime({}, {});
|
||||
}).toThrowWithMessage(TypeError, "null is not a function");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -35,3 +35,11 @@ describe("correct behavior", () => {
|
|||
expect(Math.floor(differenceSeconds)).toBe(86400);
|
||||
});
|
||||
});
|
||||
|
||||
describe("errors", () => {
|
||||
test("custom time zone doesn't have a getOffsetNanosecondsFor function", () => {
|
||||
expect(() => {
|
||||
Temporal.Now.plainDateTimeISO({});
|
||||
}).toThrowWithMessage(TypeError, "null is not a function");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -20,3 +20,11 @@ describe("correct behavior", () => {
|
|||
// FIXME: Compare these in a sensible way
|
||||
});
|
||||
});
|
||||
|
||||
describe("errors", () => {
|
||||
test("custom time zone doesn't have a getOffsetNanosecondsFor function", () => {
|
||||
expect(() => {
|
||||
Temporal.Now.plainTimeISO({});
|
||||
}).toThrowWithMessage(TypeError, "null is not a function");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -36,3 +36,12 @@ describe("correct behavior", () => {
|
|||
expect(createdPlainDate.day).toBe(26);
|
||||
});
|
||||
});
|
||||
|
||||
describe("errors", () => {
|
||||
test("custom time zone doesn't have a getOffsetNanosecondsFor function", () => {
|
||||
const zonedDateTime = new Temporal.ZonedDateTime(0n, {});
|
||||
expect(() => {
|
||||
Temporal.PlainDate.from(zonedDateTime);
|
||||
}).toThrowWithMessage(TypeError, "null is not a function");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -170,3 +170,12 @@ describe("errors", () => {
|
|||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe("errors", () => {
|
||||
test("custom time zone doesn't have a getOffsetNanosecondsFor function", () => {
|
||||
const zonedDateTime = new Temporal.ZonedDateTime(0n, {});
|
||||
expect(() => {
|
||||
Temporal.PlainDateTime.from(zonedDateTime);
|
||||
}).toThrowWithMessage(TypeError, "null is not a function");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -48,3 +48,12 @@ describe("correct behavior", () => {
|
|||
expect(createdPlainTime.nanosecond).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe("errors", () => {
|
||||
test("custom time zone doesn't have a getOffsetNanosecondsFor function", () => {
|
||||
const zonedDateTime = new Temporal.ZonedDateTime(0n, {});
|
||||
expect(() => {
|
||||
Temporal.PlainTime.from(zonedDateTime);
|
||||
}).toThrowWithMessage(TypeError, "null is not a function");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -49,3 +49,12 @@ describe("correct behavior", () => {
|
|||
expect(plainDateTime.nanosecond).toBe(123);
|
||||
});
|
||||
});
|
||||
|
||||
describe("errors", () => {
|
||||
test("custom time zone doesn't have a getOffsetNanosecondsFor function", () => {
|
||||
const instant = new Temporal.Instant(1n);
|
||||
expect(() => {
|
||||
Temporal.TimeZone.prototype.getPlainDateTimeFor.call({}, instant);
|
||||
}).toThrowWithMessage(TypeError, "null is not a function");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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");
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue