MCPcopy Create free account
hub / github.com/PageLeay/celestial-runtime / rejects

Function rejects

misc/test-browser/assert.js:84–104  ·  view source on GitHub ↗
(func, checkFunc, reason)

Source from the content-addressed store, hash-verified

82}
83
84export 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
106export default {
107 equal, deepEqual, ok, rejects, throws

Callers

nothing calls this directly

Calls 2

throwErrorFunction · 0.70
funcFunction · 0.50

Tested by

no test coverage detected