arch-unit-ts
Version:
34 lines • 1.9 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.GivenMethodsInternal = void 0;
const AllowEmptyShould_1 = require("../AllowEmptyShould");
const MethodsTransformer_1 = require("../MethodsTransformer");
const ConditionAggregator_1 = require("./ConditionAggregator");
const MethodsShouldInternal_1 = require("./MethodsShouldInternal");
const MethodsThatInternal_1 = require("./MethodsThatInternal");
const PredicateAggregator_1 = require("./PredicateAggregator");
class GivenMethodsInternal {
methodsTransformer;
prepareCondition;
constructor(methodsTransformer, prepareCondition) {
this.methodsTransformer = methodsTransformer;
this.prepareCondition = prepareCondition;
}
static default() {
return new GivenMethodsInternal(new MethodsTransformer_1.MethodsTransformer('methods', PredicateAggregator_1.PredicateAggregator.default()), (condition) => condition);
}
that() {
return new MethodsThatInternal_1.MethodsThatInternal((predicate) => new GivenMethodsInternal(this.methodsTransformer.addPredicate(predicate), this.prepareCondition));
}
should() {
return new MethodsShouldInternal_1.MethodsShouldInternal(this.methodsTransformer, ConditionAggregator_1.ConditionAggregator.default(), this.prepareCondition, AllowEmptyShould_1.AllowEmptyShould.asConfigured());
}
and() {
return new MethodsThatInternal_1.MethodsThatInternal((predicate) => new GivenMethodsInternal(this.methodsTransformer.switchModeAnd().addPredicate(predicate), this.prepareCondition));
}
or() {
return new MethodsThatInternal_1.MethodsThatInternal((predicate) => new GivenMethodsInternal(this.methodsTransformer.switchModeOr().addPredicate(predicate), this.prepareCondition));
}
}
exports.GivenMethodsInternal = GivenMethodsInternal;
//# sourceMappingURL=GivenMethodsInternal.js.map