UNPKG

@thisisagile/easy-test

Version:

Straightforward library for testing microservices built with @thisisagile/easy

39 lines (38 loc) 1.01 kB
import { match } from "../chunk-LN24S2PC.mjs"; import { toMessage } from "../chunk-6EKWTLNQ.mjs"; import "../chunk-O475TEG2.mjs"; // src/matchers/toFailMatcher.ts var Fails = { Yes: "Match fails, instead of passes.", No: (reason) => `Match doesn't fail, because '${reason}'` }; var FailsWith = { Yes: "Match fails with correct message.", No: (message, instead) => `Match does fail, however not with message '${message}', but with message '${instead}' instead.` }; var toFailMatcher = (result) => match(result).not( (c) => !c.pass, (c) => Fails.No(c.message()) ).else(Fails.Yes); var toFailMatcherWith = (result, message) => match(result).not( (c) => !c.pass, (c) => Fails.No(c.message()) ).not( (c) => c.message().includes(toMessage(message)), (c) => FailsWith.No(toMessage(message), c.message()) ).else(FailsWith.Yes); expect.extend({ toFailMatcher, toFailMatcherWith }); export { Fails, FailsWith, toFailMatcher, toFailMatcherWith }; //# sourceMappingURL=toFailMatcher.mjs.map