mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 13:07:46 +00:00
LibJS: Leverage PrepareTemporalFields in ToTemporalTimeRecord
This is an editorial change in the Temporal spec.
See: b5ba981
This commit is contained in:
parent
6cc69bbd8e
commit
e96df3b7a7
5 changed files with 52 additions and 45 deletions
|
@ -92,10 +92,16 @@ describe("errors", () => {
|
|||
test("argument is an invalid plain time-like object", () => {
|
||||
expect(() => {
|
||||
new Temporal.PlainTime().with({});
|
||||
}).toThrowWithMessage(TypeError, "Invalid plain time-like object");
|
||||
}).toThrowWithMessage(
|
||||
TypeError,
|
||||
"Object must have at least one of the following properties: hour, microsecond, millisecond, minute, nanosecond, second"
|
||||
);
|
||||
expect(() => {
|
||||
new Temporal.PlainTime().with({ foo: 1, bar: 2 });
|
||||
}).toThrowWithMessage(TypeError, "Invalid plain time-like object");
|
||||
}).toThrowWithMessage(
|
||||
TypeError,
|
||||
"Object must have at least one of the following properties: hour, microsecond, millisecond, minute, nanosecond, second"
|
||||
);
|
||||
});
|
||||
|
||||
test("error when coercing property to number", () => {
|
||||
|
|
|
@ -118,10 +118,16 @@ describe("errors", () => {
|
|||
test("invalid plain time-like object", () => {
|
||||
expect(() => {
|
||||
new Temporal.ZonedDateTime(1n, {}).withPlainTime({});
|
||||
}).toThrowWithMessage(TypeError, "Invalid plain time-like object");
|
||||
}).toThrowWithMessage(
|
||||
TypeError,
|
||||
"Object must have at least one of the following properties: hour, microsecond, millisecond, minute, nanosecond, second"
|
||||
);
|
||||
|
||||
expect(() => {
|
||||
new Temporal.ZonedDateTime(1n, {}).withPlainTime({ foo: 1, bar: 2 });
|
||||
}).toThrowWithMessage(TypeError, "Invalid plain time-like object");
|
||||
}).toThrowWithMessage(
|
||||
TypeError,
|
||||
"Object must have at least one of the following properties: hour, microsecond, millisecond, minute, nanosecond, second"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue