UNPKG

@thisisagile/easy-test

Version:

Straightforward library for testing microservices built with @thisisagile/easy

30 lines 1.09 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.fits = void 0; const asymmetricMatchers_1 = require("expect/build/asymmetricMatchers"); const Utils_1 = require("../utils/Utils"); const Eq_1 = require("../utils/Eq"); class ObjectContainingText extends asymmetricMatchers_1.AsymmetricMatcher { asymmetricMatch(other) { return (0, Utils_1.asString)(this.sample) === (0, Utils_1.asString)(other); } toString() { return `String${this.inverse ? 'Not' : ''}Containing`; } } class ObjectContainingJson extends asymmetricMatchers_1.AsymmetricMatcher { asymmetricMatch(other) { return Eq_1.eq.subset((0, Utils_1.asJson)(other), (0, Utils_1.asJson)(this.sample)); } toString() { return `Object${this.inverse ? 'Not' : ''}Containing`; } } exports.fits = { any: () => expect.anything(), type: (type) => expect.any(type), with: (o) => expect.objectContaining(o), text: (s) => new ObjectContainingText(s), json: (s) => new ObjectContainingJson(s), }; //# sourceMappingURL=Fits.js.map