-
Notifications
You must be signed in to change notification settings - Fork 2.5k
/
Copy pathset.test.ts
42 lines (36 loc) · 870 Bytes
/
set.test.ts
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
import { test, expect } from "@jest/globals";
import { difference, intersection, union } from "../set.js";
test("difference", () => {
const set1 = new Set(["a", "b"]);
const set2 = new Set(["b", "c"]);
const resultSet = difference(set1, set2);
expect(resultSet).toMatchInlineSnapshot(`
Set {
"a",
}
`);
});
test("intersection", () => {
const set1 = new Set(["a", "b", "c", "d"]);
const set2 = new Set(["b", "c", "e"]);
const resultSet = intersection(set1, set2);
expect(resultSet).toMatchInlineSnapshot(`
Set {
"b",
"c",
}
`);
});
test("union", () => {
const set1 = new Set(["a", "b"]);
const set2 = new Set(["c", "d"]);
const resultSet = union(set1, set2);
expect(resultSet).toMatchInlineSnapshot(`
Set {
"a",
"b",
"c",
"d",
}
`);
});