blob: 734ad9dffd52d9ff0da4ce1fe960c707148a847f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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);
});
});
|