mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:17:44 +00:00
LibJS/Tests: Add Temporal.TimeZone() tests for numeric UTC offset
This works now, let's test it :^)
This commit is contained in:
parent
d92558b3b3
commit
de07312cc7
1 changed files with 34 additions and 1 deletions
|
@ -31,5 +31,38 @@ describe("normal behavior", () => {
|
|||
expect(new Temporal.TimeZone("uTC").id).toBe("UTC");
|
||||
});
|
||||
|
||||
// TODO: Add tests for time numeric zone offset once that's implemented
|
||||
test("numeric UTC offset", () => {
|
||||
const signs = [
|
||||
["+", "+"],
|
||||
["-", "-"],
|
||||
["\u2212", "-"],
|
||||
];
|
||||
const values = [
|
||||
["01", "01:00"],
|
||||
["0123", "01:23"],
|
||||
["012345", "01:23:45"],
|
||||
["012345.6", "01:23:45.6"],
|
||||
["012345.123", "01:23:45.123"],
|
||||
["012345.123456789", "01:23:45.123456789"],
|
||||
["012345,6", "01:23:45.6"],
|
||||
["012345,123", "01:23:45.123"],
|
||||
["012345,123456789", "01:23:45.123456789"],
|
||||
["01:23", "01:23"],
|
||||
["01:23:45", "01:23:45"],
|
||||
["01:23:45.6", "01:23:45.6"],
|
||||
["01:23:45.123", "01:23:45.123"],
|
||||
["01:23:45.123456789", "01:23:45.123456789"],
|
||||
["01:23:45,6", "01:23:45.6"],
|
||||
["01:23:45,123", "01:23:45.123"],
|
||||
["01:23:45,123456789", "01:23:45.123456789"],
|
||||
["23:59:59.999999999", "23:59:59.999999999"],
|
||||
];
|
||||
for (const [sign, expectedSign] of signs) {
|
||||
for (const [offset, expectedOffset] of values) {
|
||||
expect(new Temporal.TimeZone(`${sign}${offset}`).id).toBe(
|
||||
`${expectedSign}${expectedOffset}`
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue