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

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

This commit is contained in:
Linus Groh 2021-07-29 23:51:55 +01:00
parent dc34cbe28b
commit c7bef42975
3 changed files with 50 additions and 0 deletions

View file

@ -0,0 +1,19 @@
describe("normal behavior", () => {
test("length is 0", () => {
expect(Temporal.PlainDate.prototype.getISOFields).toHaveLength(0);
});
test("basic functionality", () => {
const calendar = new Temporal.Calendar("iso8601");
const plainDate = new Temporal.PlainDate(2021, 7, 29, calendar);
const fields = plainDate.getISOFields();
expect(fields).toEqual({ calendar, isoDay: 29, isoMonth: 7, isoYear: 2021 });
// Test field order
expect(Object.getOwnPropertyNames(fields)).toEqual([
"calendar",
"isoDay",
"isoMonth",
"isoYear",
]);
});
});