UNPKG

@giancosta86/more-jest

Version:
25 lines 986 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.toHaveSameJson = void 0; function toHaveSameJson(actual, expected) { const { printReceived, printExpected, matcherHint } = this.utils; const actualJson = JSON.stringify(actual); const expectedJson = JSON.stringify(expected); const pass = actualJson === expectedJson; return { pass, message: () => pass ? matcherHint(".not.toHaveSameJson") + "\n\n" + "Expected JSON serialization not equal to:\n" + ` ${printExpected(expectedJson)}\n` : matcherHint(".toHaveSameJson") + "\n\n" + "Expected JSON serialization:\n" + ` ${printExpected(expectedJson)}\n` + "Received JSON serialization:\n" + ` ${printReceived(actualJson)}` }; } exports.toHaveSameJson = toHaveSameJson; //# sourceMappingURL=toHaveSameJson.js.map