jest-extended
Version:
Additional Jest matchers
15 lines (14 loc) • 607 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.toResolve = toResolve;
async function toResolve(actual) {
// @ts-expect-error OK to have implicit any for this.utils
const { matcherHint } = this.utils;
const pass = await actual.then(() => true, () => false);
return {
pass,
message: () => pass
? matcherHint('.not.toResolve', 'received', '') + '\n\nExpected promise to reject, however it resolved.\n'
: matcherHint('.toResolve', 'received', '') + '\n\nExpected promise to resolve, however it rejected.\n',
};
}