Skip to content

Commit 2f8afc1

Browse files
committed
update tests
1 parent 7bc63f1 commit 2f8afc1

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

chartlets.js/packages/lib/src/utils/compare.test.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,28 @@ describe("Test shallowEqualArrays()", () => {
77
const arr_c: string[] = ["a", "b", "d"];
88
const arr_d: string[] = [];
99
const arr_e: string[] = ["a", "b", "c", "d"];
10+
const arr_f: (string | null)[] = ["a", "b", "c", null];
11+
const arr_g: (string | null)[] = ["a", "b", "c", null];
12+
const arr_h = [1, [1, 2, 3], [4, 5, 6]];
13+
const arr_i = [1, [1, 2, 3], [4, 5, 6]];
14+
const arr_j: (number | string | null)[] = [1, 2, "c", null];
15+
const arr_k: (number | string | null)[] = [1, 3, "c", null];
16+
const arr_l: (number | string | null)[] = [1, 2, "c", null];
17+
const arr_m: number[] = [1, 2];
18+
const arr_n: number[] = [1, 2];
19+
const arr_o: null[] = [null];
20+
const arr_p: null[] = [null];
1021
it("works", () => {
1122
expect(shallowEqualArrays(arr_a, arr_b)).toBe(true);
1223
expect(shallowEqualArrays(arr_a, arr_c)).toBe(false);
1324
expect(shallowEqualArrays(arr_a, arr_d)).toBe(false);
1425
expect(shallowEqualArrays(arr_a, arr_e)).toBe(false);
26+
expect(shallowEqualArrays(arr_f, arr_g)).toBe(true);
27+
expect(shallowEqualArrays(arr_h, arr_i)).toBe(false);
28+
expect(shallowEqualArrays(arr_j, arr_k)).toBe(false);
29+
expect(shallowEqualArrays(arr_j, arr_l)).toBe(true);
30+
expect(shallowEqualArrays(arr_m, arr_n)).toBe(true);
31+
expect(shallowEqualArrays(arr_m, arr_l)).toBe(false);
32+
expect(shallowEqualArrays(arr_o, arr_p)).toBe(true);
1533
});
1634
});

0 commit comments

Comments
 (0)