UNPKG

@thisisagile/easy-test

Version:

Straightforward library for testing microservices built with @thisisagile/easy

22 lines 948 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.toMatchJson = exports.MatchesJson = void 0; const Match_1 = require("./Match"); const Eq_1 = require("../utils/Eq"); const Utils_1 = require("../utils/Utils"); exports.MatchesJson = { SubjectUndefined: 'Subject is undefined.', SubsetUndefined: 'Subset to match with is undefined.', DoesNotMatch: 'Subset does not match subject.', Yes: 'Subset matches subject', }; const toMatchJson = (value, subset) => (0, Match_1.match)(value) .undefined(v => v, exports.MatchesJson.SubjectUndefined) .undefined(() => subset, exports.MatchesJson.SubsetUndefined) .not(v => Eq_1.eq.subset((0, Utils_1.asJson)(v), (0, Utils_1.asJson)(subset)), exports.MatchesJson.DoesNotMatch) .else(() => exports.MatchesJson.Yes); exports.toMatchJson = toMatchJson; expect.extend({ toMatchJson: exports.toMatchJson, }); //# sourceMappingURL=toMatchJson.js.map