@thisisagile/easy-test
Version:
Straightforward library for testing microservices built with @thisisagile/easy
22 lines • 861 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.toBeAt = void 0;
const Utils_1 = require("../utils/Utils");
const Match_1 = require("./Match");
const toUrl = (uc, id) => {
const i = (0, Utils_1.isDefined)(id) ? `/${id}` : '';
return `/${uc.app.id}/${uc.id}${i}`;
};
const toBeAt = (tester, uc, id) => {
return (0, Match_1.match)(tester)
.undefined(t => t, 'Tester is undefined')
.undefined(t => t.url, 'Tester does not contain a URL')
.undefined(() => uc, 'Use case is undefined')
.not(t => t.url.includes(toUrl(uc, id)), t => `We expected the tester to be at: '${toUrl(uc, id)}', but it is at: '${t?.url}' instead.`)
.else(t => `The tester is at '${t?.url}'`);
};
exports.toBeAt = toBeAt;
expect.extend({
toBeAt: exports.toBeAt,
});
//# sourceMappingURL=toBeAt.js.map