@thisisagile/easy-test
Version:
Straightforward library for testing microservices built with @thisisagile/easy
26 lines (25 loc) • 958 B
JavaScript
import {
match
} from "../chunk-LN24S2PC.mjs";
import "../chunk-6EKWTLNQ.mjs";
import {
isDefined
} from "../chunk-O475TEG2.mjs";
// src/matchers/toMatchException.ts
var toMatchException = (received, expected, reason) => match(expected).undefined((e) => e.id, "Expected value is not an exception.").not(
(e) => e.id === received.id,
(e) => `Expected exception has id '${e.id}', while the received exception has id '${received.id}'.`
).not(
() => !isDefined(reason) || isDefined(reason) && isDefined(received.reason),
() => `We expected to have reason '${reason}', but we received no reason.`
).not(
() => !isDefined(reason) || isDefined(reason) && received.reason === reason,
() => `We expected to have reason '${reason}', but we received reason '${received.reason}'.`
).else(`Expected exception matches received exception`);
expect.extend({
toMatchException
});
export {
toMatchException
};
//# sourceMappingURL=toMatchException.mjs.map