summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Tests/builtins
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2021-08-27 16:42:21 +0300
committerLinus Groh <mail@linusgroh.de>2021-08-27 16:40:16 +0100
commit9ed877e8e70b5a9852f75163d860f7c2db6cc520 (patch)
tree77a6beee4943066c2ca6cdc008a9057c34d8be43 /Userland/Libraries/LibJS/Tests/builtins
parent28fa4d15689a158a6b2915f43546ba56c5cac714 (diff)
downloadserenity-9ed877e8e70b5a9852f75163d860f7c2db6cc520.zip
LibJS: Implement Temporal.PlainDateTime.compare()
Diffstat (limited to 'Userland/Libraries/LibJS/Tests/builtins')
-rw-r--r--Userland/Libraries/LibJS/Tests/builtins/Temporal/PlainDateTime/PlainDateTime.compare.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Tests/builtins/Temporal/PlainDateTime/PlainDateTime.compare.js b/Userland/Libraries/LibJS/Tests/builtins/Temporal/PlainDateTime/PlainDateTime.compare.js
new file mode 100644
index 0000000000..7eb4781f28
--- /dev/null
+++ b/Userland/Libraries/LibJS/Tests/builtins/Temporal/PlainDateTime/PlainDateTime.compare.js
@@ -0,0 +1,13 @@
+describe("correct behavior", () => {
+ test("length is 2", () => {
+ expect(Temporal.PlainDateTime.compare).toHaveLength(2);
+ });
+
+ test("basic functionality", () => {
+ const plainDateTime1 = new Temporal.PlainDateTime(2021, 8, 27, 16, 38, 40, 1, 2, 3);
+ expect(Temporal.PlainDateTime.compare(plainDateTime1, plainDateTime1)).toBe(0);
+ const plainDateTime2 = new Temporal.PlainDateTime(2021, 8, 27, 16, 39, 5, 0, 1, 2);
+ expect(Temporal.PlainDateTime.compare(plainDateTime1, plainDateTime2)).toBe(-1);
+ expect(Temporal.PlainDateTime.compare(plainDateTime2, plainDateTime1)).toBe(1);
+ });
+});