summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Tests/builtins/Temporal
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2021-08-19 08:42:49 +0100
committerLinus Groh <mail@linusgroh.de>2021-08-20 18:12:15 +0100
commit5904c6bf189354e5a858e170ed1cecaf9e3e63f0 (patch)
tree87caea83fde537c8a83a7e0bf8103b977b165382 /Userland/Libraries/LibJS/Tests/builtins/Temporal
parentea44f33d5b1ef9f8972b469184cd5e879da661cc (diff)
downloadserenity-5904c6bf189354e5a858e170ed1cecaf9e3e63f0.zip
LibJS: Implement Temporal.PlainMonthDay.prototype.toLocaleString()
Diffstat (limited to 'Userland/Libraries/LibJS/Tests/builtins/Temporal')
-rw-r--r--Userland/Libraries/LibJS/Tests/builtins/Temporal/PlainMonthDay/PlainMonthDay.prototype.toLocaleString.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Tests/builtins/Temporal/PlainMonthDay/PlainMonthDay.prototype.toLocaleString.js b/Userland/Libraries/LibJS/Tests/builtins/Temporal/PlainMonthDay/PlainMonthDay.prototype.toLocaleString.js
new file mode 100644
index 0000000000..388c4269f1
--- /dev/null
+++ b/Userland/Libraries/LibJS/Tests/builtins/Temporal/PlainMonthDay/PlainMonthDay.prototype.toLocaleString.js
@@ -0,0 +1,23 @@
+describe("correct behavior", () => {
+ test("length is 0", () => {
+ expect(Temporal.PlainMonthDay.prototype.toLocaleString).toHaveLength(0);
+ });
+
+ test("basic functionality", () => {
+ let plainMonthDay;
+
+ plainMonthDay = new Temporal.PlainMonthDay(7, 6);
+ expect(plainMonthDay.toLocaleString()).toBe("07-06");
+
+ plainMonthDay = new Temporal.PlainMonthDay(7, 6, { toString: () => "foo" }, 2021);
+ expect(plainMonthDay.toLocaleString()).toBe("2021-07-06[u-ca=foo]");
+ });
+});
+
+describe("errors", () => {
+ test("this value must be a Temporal.PlainMonthDay object", () => {
+ expect(() => {
+ Temporal.PlainMonthDay.prototype.toLocaleString.call("foo");
+ }).toThrowWithMessage(TypeError, "Not a Temporal.PlainMonthDay");
+ });
+});