@n1k1t/mock-server
Version:
The ultimate toolkit to intercept, transform, and simulate HTTP/WS traffic with type-safe expectations
35 lines • 1.17 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const operator_1 = require("../models/operator");
const utils_1 = require("../utils");
class AndExpectationOperator extends operator_1.ExpectationOperator {
constructor() {
super(...arguments);
this.compiled = this.command
.map((schema) => this.extractNestedSchema(schema))
.filter(Boolean)
.map((extracted) => {
const Operator = this.operators[extracted.key];
return new Operator(this.operators, extracted.nested);
});
}
get tags() {
return (0, utils_1.mergeMetaTags)(this.compiled.map((operator) => operator.tags));
}
async match(context) {
for (const operator of this.compiled) {
if (!(await operator.match(context))) {
return false;
}
}
return true;
}
async manipulate(context) {
for (const operator of this.compiled) {
await operator.manipulate(context);
}
return context;
}
}
exports.default = AndExpectationOperator;
//# sourceMappingURL=and.operator.js.map