@fgv/ts-utils-jest
Version:
Custom matchers for ts-utils result class
23 lines • 912 B
JavaScript
import { matcherHint } from 'jest-matcher-utils';
import { toMatchInlineSnapshot } from 'jest-snapshot';
import { printReceivedResult } from '../../utils/matcherHelpers';
const matcherName = 'toSucceedAndMatchInlineSnapshot';
export default {
toSucceedAndMatchInlineSnapshot: function (received, snapshot) {
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 toMatchInlineSnapshot.call(context, received.value, {}, snapshot);
}
};
//# sourceMappingURL=index.js.map