UNPKG

@fgv/ts-utils-jest

Version:
23 lines 893 B
import { matcherHint } from 'jest-matcher-utils'; import { toMatchSnapshot } from 'jest-snapshot'; import { printReceivedResult } from '../../utils/matcherHelpers'; const matcherName = 'toSucceedAndMatchSnapshot'; export default { toSucceedAndMatchSnapshot: function (received) { const context = this; if (received.isFailure()) { return { pass: false, message: () => { return [ matcherHint(`${matcherName}`, 'callback'), 'Expected:\n Callback to succeed with a result that matches the snapshot', printReceivedResult(received) ].join('\n'); } }; } return toMatchSnapshot.call(context, received.value, 'toSucceedAndMatchSnapshot'); } }; //# sourceMappingURL=index.js.map