summaryrefslogtreecommitdiff
path: root/test.ts
diff options
context:
space:
mode:
authornetop://ウィビ <paul@webb.page>2026-04-11 14:45:40 -0700
committernetop://ウィビ <paul@webb.page>2026-04-11 14:45:40 -0700
commit1aa441fb05917ad75aede548ba3b84fbf36caf64 (patch)
tree17b5255575b3858071a8be65cf5930ae434ec68c /test.ts
initial commitHEADprimary
Diffstat (limited to 'test.ts')
-rw-r--r--test.ts44
1 files changed, 44 insertions, 0 deletions
diff --git a/test.ts b/test.ts
new file mode 100644
index 0000000..734ad9d
--- /dev/null
+++ b/test.ts
@@ -0,0 +1,44 @@
+
+
+
+//// import
+
+import { assertEquals } from "jsr:@std/assert";
+
+//// util
+
+import { orderObject } from "./mod.ts";
+
+
+
+//// program
+
+Deno.test("Test orderObject", async(t) => {
+ await t.step("Returns null when no options are supplied", () => {
+ assertEquals(orderObject(), null);
+ });
+
+ await t.step("Returns empty array when supplied the same", () => {
+ assertEquals(orderObject([]), []);
+ });
+
+ await t.step("Returns empty object when supplied the same", () => {
+ assertEquals(orderObject({}), {});
+ });
+
+ await t.step("Returns ordered object", () => {
+ const options = {
+ zebra: "yay",
+ 1: "neo",
+ horse: "neigh"
+ };
+
+ const expectedResponse = {
+ "1": "neo",
+ horse: "neigh",
+ zebra: "yay"
+ };
+
+ assertEquals(orderObject(options), expectedResponse);
+ });
+});