mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 14:57:35 +00:00
LibJS: Implement Temporal.PlainDate.prototype.era
This commit is contained in:
parent
c3e0d78ba6
commit
6f7d6d917e
5 changed files with 67 additions and 0 deletions
|
@ -0,0 +1,24 @@
|
|||
describe("correct behavior", () => {
|
||||
test("basic functionality", () => {
|
||||
const plainDate = new Temporal.PlainDate(2021, 7, 6);
|
||||
expect(plainDate.era).toBeUndefined();
|
||||
});
|
||||
|
||||
test("calendar with custom era function", () => {
|
||||
const calendar = {
|
||||
era() {
|
||||
return "foo";
|
||||
},
|
||||
};
|
||||
const plainDate = new Temporal.PlainDate(2021, 7, 6, calendar);
|
||||
expect(plainDate.era).toBe("foo");
|
||||
});
|
||||
});
|
||||
|
||||
describe("errors", () => {
|
||||
test("this value must be a Temporal.PlainDate object", () => {
|
||||
expect(() => {
|
||||
Reflect.get(Temporal.PlainDate.prototype, "era", "foo");
|
||||
}).toThrowWithMessage(TypeError, "Not a Temporal.PlainDate");
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue