-
Notifications
You must be signed in to change notification settings - Fork 0
/
set.test.ts
79 lines (71 loc) · 1.56 KB
/
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import { assertStrictEq, prepareTest } from "../test.mod.ts";
import { extend } from "./extend.ts";
import {
difference,
from,
intersection,
isDisjoint,
isEmpty,
isSet,
isSubset,
isSuperset,
iter,
len,
of,
symmetricDifference,
toArray,
union
} from "./set.ts";
extend({
set: [
difference,
from,
intersection,
isDisjoint,
isEmpty,
isSet,
isSubset,
isSuperset,
iter,
len,
of,
symmetricDifference,
toArray,
union
]
});
async function willExtendSetPrototype() {
const extensions = [
["Set.prototype.difference", "difference"],
["Set.prototype.intersection", "intersection"],
["Set.prototype.isDisjoint", "isDisjoint"],
["Set.prototype.isEmpty", "isEmpty"],
["Set.prototype.isSubset", "isSubset"],
["Set.prototype.isSuperset", "isSuperset"],
["Set.prototype.iter", "iter"],
["Set.prototype.len", "len"],
["Set.prototype.symmetricDifference", "symmetricDifference"],
["Set.prototype.toArray", "toArray"],
["Set.prototype.union", "union"]
];
const expectation = extensions.every(([_, methodName]) => {
return methodName in Set.prototype;
});
assertStrictEq(expectation, true);
}
async function willExtendSetConstructor() {
const extensions = [
["Set.from", "from"],
["Set.isSet", "isSet"],
["Set.of", "of"]
];
const expectation = extensions.every(([_, methodName]) => {
return methodName in Set;
});
assertStrictEq(expectation, true);
}
prepareTest(
[willExtendSetConstructor, willExtendSetPrototype],
"jsmodern",
"set"
);