mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 23:17:45 +00:00
LibJS: Implement Temporal.PlainMonthDay.prototype.getISOFields()
This commit is contained in:
parent
7fb05eb878
commit
1549845389
3 changed files with 57 additions and 0 deletions
|
@ -0,0 +1,27 @@
|
|||
describe("normal behavior", () => {
|
||||
test("length is 0", () => {
|
||||
expect(Temporal.PlainMonthDay.prototype.getISOFields).toHaveLength(0);
|
||||
});
|
||||
|
||||
test("basic functionality", () => {
|
||||
const calendar = new Temporal.Calendar("iso8601");
|
||||
const plainMonthDay = new Temporal.PlainMonthDay(7, 6, calendar, 2021);
|
||||
const fields = plainMonthDay.getISOFields();
|
||||
expect(fields).toEqual({ calendar, isoDay: 6, isoMonth: 7, isoYear: 2021 });
|
||||
// Test field order
|
||||
expect(Object.getOwnPropertyNames(fields)).toEqual([
|
||||
"calendar",
|
||||
"isoDay",
|
||||
"isoMonth",
|
||||
"isoYear",
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("errors", () => {
|
||||
test("this value must be a Temporal.PlainMonthDay object", () => {
|
||||
expect(() => {
|
||||
Temporal.PlainMonthDay.prototype.getISOFields.call("foo");
|
||||
}).toThrowWithMessage(TypeError, "Not a Temporal.PlainMonthDay");
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue