-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdev_deps.ts
46 lines (42 loc) · 961 Bytes
/
dev_deps.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
export * from "https://deno.land/std@0.150.0/testing/bdd.ts";
import {
defineExpect,
jestMatcherMap,
jestModifierMap,
} from "https://deno.land/x/unitest@v1.0.0-beta.82/mod.ts";
export const expect = defineExpect({
matcherMap: {
...jestMatcherMap,
toError: (
actual: unknown,
// deno-lint-ignore ban-types
error: Function,
message?: string,
) => {
if (!(actual instanceof Error)) {
return {
pass: false,
expected: "Error Object",
};
}
if (!(actual instanceof error)) {
return {
pass: false,
expected: `${error.name} Object`,
};
}
if (message) {
return {
pass: actual.message === message,
expected: message,
resultActual: actual.message,
};
}
return {
pass: true,
expected: error,
};
},
},
modifierMap: jestModifierMap,
});