arch-unit-ts
Version:
46 lines • 2.48 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.GivenClassesInternal = void 0;
const AllowEmptyShould_1 = require("../AllowEmptyShould");
const ClassesTransformer_1 = require("../ClassesTransformer");
const ClassesShouldInternal_1 = require("./ClassesShouldInternal");
const ClassesThatInternal_1 = require("./ClassesThatInternal");
const ConditionAggregator_1 = require("./ConditionAggregator");
const PredicateAggregator_1 = require("./PredicateAggregator");
class GivenClassesInternal {
classesTransformer;
prepareCondition;
constructor(classesTransformer, prepareCondition) {
this.classesTransformer = classesTransformer;
this.prepareCondition = prepareCondition;
}
static default() {
return new GivenClassesInternal(new ClassesTransformer_1.ClassesTransformer('classes', PredicateAggregator_1.PredicateAggregator.default()), (archCondition) => archCondition);
}
that() {
return new ClassesThatInternal_1.ClassesThatInternal(describedPredicate => {
return new GivenClassesInternal(this.classesTransformer.addPredicate(describedPredicate), this.prepareCondition);
});
}
thatWithPredicate(predicate) {
return new GivenClassesInternal(this.classesTransformer.addPredicate(predicate), this.prepareCondition);
}
should() {
return new ClassesShouldInternal_1.ClassesShouldInternal(this.classesTransformer, ConditionAggregator_1.ConditionAggregator.default(), this.prepareCondition, AllowEmptyShould_1.AllowEmptyShould.asConfigured());
}
shouldWithConjunction(condition) {
return new ClassesShouldInternal_1.ClassesShouldInternal(this.classesTransformer, ConditionAggregator_1.ConditionAggregator.default().add(condition), this.prepareCondition, AllowEmptyShould_1.AllowEmptyShould.asConfigured());
}
and() {
return new ClassesThatInternal_1.ClassesThatInternal(describedPredicate => {
return new GivenClassesInternal(this.classesTransformer.switchModeAnd().addPredicate(describedPredicate), this.prepareCondition);
});
}
or() {
return new ClassesThatInternal_1.ClassesThatInternal(describedPredicate => {
return new GivenClassesInternal(this.classesTransformer.switchModeOr().addPredicate(describedPredicate), this.prepareCondition);
});
}
}
exports.GivenClassesInternal = GivenClassesInternal;
//# sourceMappingURL=GivenClassesInternal.js.map