UNPKG

@fgv/ts-utils-jest

Version:

Custom matchers for ts-utils result class

25 lines 1.05 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const jest_matcher_utils_1 = require("jest-matcher-utils"); const jest_snapshot_1 = require("jest-snapshot"); const matcherHelpers_1 = require("../../utils/matcherHelpers"); const matcherName = 'toSucceedAndMatchSnapshot'; exports.default = { toSucceedAndMatchSnapshot: function (received) { const context = this; if (received.isFailure()) { return { pass: false, message: () => { return [ (0, jest_matcher_utils_1.matcherHint)(`${matcherName}`, 'callback'), 'Expected:\n Callback to succeed with a result that matches the snapshot', (0, matcherHelpers_1.printReceivedResult)(received) ].join('\n'); } }; } return jest_snapshot_1.toMatchSnapshot.call(context, received.value, 'toSucceedAndMatchSnapshot'); } }; //# sourceMappingURL=index.js.map