(func, checkFunc, reason)
| 82 | } |
| 83 | |
| 84 | export async function rejects(func, checkFunc, reason) { |
| 85 | try { |
| 86 | if (func.then) { |
| 87 | await func; |
| 88 | } else { |
| 89 | await func(); |
| 90 | } |
| 91 | } catch (e) { |
| 92 | if (checkFunc(e)) { return true; } |
| 93 | |
| 94 | throwError(`The rejection validation function returned false`, { |
| 95 | actual: e, |
| 96 | expected: checkFunc, |
| 97 | operation: "throws" |
| 98 | }); |
| 99 | } |
| 100 | |
| 101 | throwError("Missing rejection", { |
| 102 | operation: "rejects" |
| 103 | }); |
| 104 | } |
| 105 | |
| 106 | export default { |
| 107 | equal, deepEqual, ok, rejects, throws |
nothing calls this directly
no test coverage detected