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