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

LibJS: Implement Temporal.PlainTime.prototype.getISOFields()

This commit is contained in:
Linus Groh 2021-07-29 23:59:02 +01:00
parent c7bef42975
commit e7c5c3d507
3 changed files with 68 additions and 0 deletions

View file

@ -0,0 +1,29 @@
describe("normal behavior", () => {
test("length is 0", () => {
expect(Temporal.PlainTime.prototype.getISOFields).toHaveLength(0);
});
test("basic functionality", () => {
const plainTime = new Temporal.PlainTime(23, 53, 18, 123, 456, 789);
const fields = plainTime.getISOFields();
expect(fields).toEqual({
calendar: plainTime.calendar,
isoHour: 23,
isoMicrosecond: 456,
isoMillisecond: 123,
isoMinute: 53,
isoNanosecond: 789,
isoSecond: 18,
});
// Test field order
expect(Object.getOwnPropertyNames(fields)).toEqual([
"calendar",
"isoHour",
"isoMicrosecond",
"isoMillisecond",
"isoMinute",
"isoNanosecond",
"isoSecond",
]);
});
});