archunit
Version:
ArchUnit TypeScript is an architecture testing library, to specify and assert architecture rules in your TypeScript app
38 lines (35 loc) • 1.11 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
const __1 = require("../..");
const projectPath = __dirname + '/layered-arch-1/tsconfig.json';
describe('UML Layered Architecture', () => {
it('should follow layered architecture diagram', async () => {
const diagram = `
@startuml
package "Presentation Layer" {
[Controllers]
}
package "Business Layer" {
[Services]
}
package "Data Layer" {
[Repositories]
}
[Controllers] --> [Services]
[Services] --> [Repositories]
@enduml`;
const rule = (0, __1.projectSlices)(projectPath)
.definedBy('src/**/(**)')
.should()
.adhereToDiagram(diagram);
await expect(rule).toPassAsync();
});
it('should not allow controllers to directly access repositories', async () => {
const rule = (0, __1.projectSlices)(projectPath)
.definedBy('src/**/(**)')
.shouldNot()
.containDependency('Controllers', 'Repositories');
await expect(rule).toPassAsync();
});
});
//# sourceMappingURL=uml-layered.spec.js.map
;