summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Tests
diff options
context:
space:
mode:
authorLuke Wilde <lukew@serenityos.org>2021-09-09 04:57:08 +0100
committerLinus Groh <mail@linusgroh.de>2021-09-09 09:06:23 +0100
commit90ada407db6f73109932f1fab1c720fa608ebce1 (patch)
tree6d1c011f58f179576df846f92880f29b90ad7dd4 /Userland/Libraries/LibJS/Tests
parent092ec0cecf86d5a58469b8f60750c810e6a25df8 (diff)
downloadserenity-90ada407db6f73109932f1fab1c720fa608ebce1.zip
LibJS: Implement Temporal.PlainYearMonth.compare
Diffstat (limited to 'Userland/Libraries/LibJS/Tests')
-rw-r--r--Userland/Libraries/LibJS/Tests/builtins/Temporal/PlainYearMonth/PlainYearMonth.compare.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Tests/builtins/Temporal/PlainYearMonth/PlainYearMonth.compare.js b/Userland/Libraries/LibJS/Tests/builtins/Temporal/PlainYearMonth/PlainYearMonth.compare.js
new file mode 100644
index 0000000000..789845e8d2
--- /dev/null
+++ b/Userland/Libraries/LibJS/Tests/builtins/Temporal/PlainYearMonth/PlainYearMonth.compare.js
@@ -0,0 +1,14 @@
+describe("correct behavior", () => {
+ test("length is 2", () => {
+ expect(Temporal.PlainYearMonth.compare).toHaveLength(2);
+ });
+
+ test("basic functionality", () => {
+ const plainYearMonth1 = new Temporal.PlainYearMonth(2021, 8);
+ expect(Temporal.PlainYearMonth.compare(plainYearMonth1, plainYearMonth1)).toBe(0);
+ const plainYearMonth2 = new Temporal.PlainYearMonth(2021, 9);
+ expect(Temporal.PlainYearMonth.compare(plainYearMonth2, plainYearMonth2)).toBe(0);
+ expect(Temporal.PlainYearMonth.compare(plainYearMonth1, plainYearMonth2)).toBe(-1);
+ expect(Temporal.PlainYearMonth.compare(plainYearMonth2, plainYearMonth1)).toBe(1);
+ });
+});