summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Tests
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2021-08-27 20:03:41 +0100
committerLinus Groh <mail@linusgroh.de>2021-08-27 23:36:52 +0100
commit6f7d6d917e658952d7a81e10421c1274a2648bc7 (patch)
tree8a9145dfb5640c8cebb7d9152dfeabc420a687f4 /Userland/Libraries/LibJS/Tests
parentc3e0d78ba63971d86f06fb6376d12cf02e083244 (diff)
downloadserenity-6f7d6d917e658952d7a81e10421c1274a2648bc7.zip
LibJS: Implement Temporal.PlainDate.prototype.era
Diffstat (limited to 'Userland/Libraries/LibJS/Tests')
-rw-r--r--Userland/Libraries/LibJS/Tests/builtins/Temporal/PlainDate/PlainDate.prototype.era.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Tests/builtins/Temporal/PlainDate/PlainDate.prototype.era.js b/Userland/Libraries/LibJS/Tests/builtins/Temporal/PlainDate/PlainDate.prototype.era.js
new file mode 100644
index 0000000000..f0f43dacc6
--- /dev/null
+++ b/Userland/Libraries/LibJS/Tests/builtins/Temporal/PlainDate/PlainDate.prototype.era.js
@@ -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");
+ });
+});