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

LibJS/Tests: Add Temporal.TimeZone() tests for numeric UTC offset

This works now, let's test it :^)
This commit is contained in:
Linus Groh 2022-01-11 20:01:07 +01:00
parent d92558b3b3
commit de07312cc7

View file

@ -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}`
);
}
}
});
});