@rcompat/test 0.1.9 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/private/Assert.d.ts +10 -9
- package/lib/private/Assert.js +14 -4
- package/package.json +2 -2
package/lib/private/Assert.d.ts
CHANGED
|
@@ -3,15 +3,16 @@ import type UnknownFunction from "@rcompat/type/UnknownFunction";
|
|
|
3
3
|
export default class Assert<T> {
|
|
4
4
|
#private;
|
|
5
5
|
constructor(actual: T, test: Test);
|
|
6
|
-
equals
|
|
7
|
-
nequals(expected: unknown):
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
equals(expected: unknown): this;
|
|
7
|
+
nequals(expected: unknown): this;
|
|
8
|
+
type<_Expected extends T>(): this;
|
|
9
|
+
true(): this;
|
|
10
|
+
false(): this;
|
|
11
|
+
null(): this;
|
|
12
|
+
undefined(): this;
|
|
13
|
+
instance(expected: UnknownFunction): this;
|
|
14
|
+
throws(expected?: string): this;
|
|
15
|
+
tries(): this;
|
|
15
16
|
fail(reason: string): void;
|
|
16
17
|
}
|
|
17
18
|
//# sourceMappingURL=Assert.d.ts.map
|
package/lib/private/Assert.js
CHANGED
|
@@ -18,27 +18,35 @@ export default class Assert {
|
|
|
18
18
|
}
|
|
19
19
|
equals(expected) {
|
|
20
20
|
this.#report(equals(this.#actual, expected), expected);
|
|
21
|
+
return this;
|
|
21
22
|
}
|
|
22
23
|
nequals(expected) {
|
|
23
24
|
this.#report(!equals(this.#actual, expected), expected);
|
|
25
|
+
return this;
|
|
26
|
+
}
|
|
27
|
+
type() {
|
|
28
|
+
// noop
|
|
29
|
+
return this;
|
|
24
30
|
}
|
|
25
31
|
#static(expected) {
|
|
26
32
|
this.#report(equals(this.#actual, expected), expected);
|
|
33
|
+
return this;
|
|
27
34
|
}
|
|
28
35
|
true() {
|
|
29
|
-
this.#static(true);
|
|
36
|
+
return this.#static(true);
|
|
30
37
|
}
|
|
31
38
|
false() {
|
|
32
|
-
this.#static(false);
|
|
39
|
+
return this.#static(false);
|
|
33
40
|
}
|
|
34
41
|
null() {
|
|
35
|
-
this.#static(null);
|
|
42
|
+
return this.#static(null);
|
|
36
43
|
}
|
|
37
44
|
undefined() {
|
|
38
|
-
this.#static(undefined);
|
|
45
|
+
return this.#static(undefined);
|
|
39
46
|
}
|
|
40
47
|
instance(expected) {
|
|
41
48
|
this.#report(this.#actual instanceof expected, expected);
|
|
49
|
+
return this;
|
|
42
50
|
}
|
|
43
51
|
throws(expected) {
|
|
44
52
|
try {
|
|
@@ -54,6 +62,7 @@ export default class Assert {
|
|
|
54
62
|
this.#failed(expected, message);
|
|
55
63
|
}
|
|
56
64
|
}
|
|
65
|
+
return this;
|
|
57
66
|
}
|
|
58
67
|
tries() {
|
|
59
68
|
try {
|
|
@@ -63,6 +72,7 @@ export default class Assert {
|
|
|
63
72
|
catch (error) {
|
|
64
73
|
this.#failed(E(error).message, "[did not throw]");
|
|
65
74
|
}
|
|
75
|
+
return this;
|
|
66
76
|
}
|
|
67
77
|
fail(reason) {
|
|
68
78
|
this.#failed(reason);
|
package/package.json
CHANGED