1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 03:17:34 +00:00

LibJS: Adjust order of operations in ISO{Date,MonthDay}FromFields

This is a normative change in the Temporal spec.

See: 7dd90dc
This commit is contained in:
Linus Groh 2022-06-15 00:45:31 +01:00
parent 3bc54ac75a
commit 569c2dc1d0
8 changed files with 32 additions and 40 deletions

View file

@ -129,12 +129,16 @@ describe("errors", () => {
test("requires year property", () => {
expect(() => {
Temporal.ZonedDateTime.from({ timeZone: new Temporal.TimeZone("UTC") });
}).toThrowWithMessage(TypeError, "Required property year is missing or undefined");
}).toThrowWithMessage(TypeError, "Required property day is missing or undefined");
});
test("requires month property", () => {
expect(() => {
Temporal.ZonedDateTime.from({ timeZone: new Temporal.TimeZone("UTC"), year: 2021 });
Temporal.ZonedDateTime.from({
timeZone: new Temporal.TimeZone("UTC"),
day: 1,
year: 2021,
});
}).toThrowWithMessage(TypeError, "Required property month is missing or undefined");
});

View file

@ -70,14 +70,14 @@ describe("errors", () => {
test("missing properties", () => {
expect(() => {
new Temporal.ZonedDateTime(1n, {}).withPlainDate({});
}).toThrowWithMessage(TypeError, "Required property year is missing or undefined");
}).toThrowWithMessage(TypeError, "Required property day is missing or undefined");
expect(() => {
new Temporal.ZonedDateTime(1n, {}).withPlainDate({ year: 1 });
new Temporal.ZonedDateTime(1n, {}).withPlainDate({ day: 1, year: 1 });
}).toThrowWithMessage(TypeError, "Required property month is missing or undefined");
expect(() => {
new Temporal.ZonedDateTime(1n, {}).withPlainDate({ year: 1, month: 1 });
}).toThrowWithMessage(TypeError, "Required property day is missing or undefined");
new Temporal.ZonedDateTime(1n, {}).withPlainDate({ day: 1, month: 1 });
}).toThrowWithMessage(TypeError, "Required property year is missing or undefined");
});
});