-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
249 additions
and
537 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"showImportsWarning": false, | ||
"failOnEmptyShould": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import { RelativePath } from "arch-unit-ts/dist/arch-unit/core/domain/RelativePath"; | ||
import { TypeScriptProject } from "arch-unit-ts/dist/arch-unit/core/domain/TypeScriptProject"; | ||
import { Architectures } from "arch-unit-ts/dist/arch-unit/library/Architectures"; | ||
import { classes, noClasses } from "arch-unit-ts/dist/main"; | ||
import { MatchingPattern } from "./folderPattern"; | ||
describe("Architecture test", () => { | ||
const srcProject = new TypeScriptProject(RelativePath.of("src")); | ||
|
||
describe("Application", () => { | ||
it("Should not depend on infrastructure", () => { | ||
noClasses() | ||
.that() | ||
.resideInAPackage(MatchingPattern.CORE) | ||
.should() | ||
.dependOnClassesThat() | ||
.resideInAnyPackage(MatchingPattern.INFRA) | ||
.because("core should not depend on infrastructure") | ||
.check(srcProject.allClasses()); | ||
}); | ||
it("Should only have few dependencies", () => { | ||
classes() | ||
.that() | ||
.resideInAPackage(MatchingPattern.CORE) | ||
.should() | ||
.onlyDependOnClassesThat() | ||
.resideInAnyPackage( | ||
MatchingPattern.SNU_LIB, | ||
MatchingPattern.CORE, | ||
MatchingPattern.NESTJS_COMMON, | ||
MatchingPattern.NESTJS_TESTING, | ||
) | ||
.because("Core should not depend on any other dependencies") | ||
.check(srcProject.allClasses()); | ||
}); | ||
}); | ||
|
||
describe("Admin", () => { | ||
it("Should implement an hexagonal architecture", async () => { | ||
Architectures.layeredArchitecture() | ||
.consideringOnlyDependenciesInAnyPackage(MatchingPattern.ADMIN_CORE, MatchingPattern.ADMIN_INFRA) | ||
.layer("useCase", MatchingPattern.ADMIN_USECASE) | ||
.layer("repository", MatchingPattern.ADMIN_REPOSITORY) | ||
.layer("infra", MatchingPattern.ADMIN_INFRA) | ||
.layer("core", MatchingPattern.ADMIN_CORE) | ||
.whereLayer("useCase") | ||
.mayOnlyBeAccessedByLayers("infra", "useCase") | ||
.whereLayer("repository") | ||
.mayOnlyBeAccessedByLayers("infra") | ||
.whereLayer("infra") | ||
.mayNotBeAccessedByAnyLayer() | ||
.because("Each bounded context should implement an hexagonal architecture") | ||
.check(srcProject.allClasses()); | ||
}); | ||
it("Should depend on specific dependencies", async () => { | ||
classes() | ||
.that() | ||
.resideInAPackage(MatchingPattern.ADMIN_CORE) | ||
.should() | ||
.onlyDependOnClassesThat() | ||
.resideInAnyPackage( | ||
MatchingPattern.SNU_LIB, | ||
MatchingPattern.NOTIFICATION_CORE, | ||
MatchingPattern.SHARED_CORE, | ||
MatchingPattern.ADMIN_CORE, | ||
MatchingPattern.NESTJS_COMMON, | ||
MatchingPattern.NESTJS_TESTING, | ||
) | ||
.because("Core should not depend on any other dependencies") | ||
.check(srcProject.allClasses()); | ||
}); | ||
}); | ||
|
||
describe("Shared", () => { | ||
it("Should depend on specific dependencies", async () => { | ||
classes() | ||
.that() | ||
.resideInAPackage(MatchingPattern.SHARED_CORE) | ||
.should() | ||
.onlyDependOnClassesThat() | ||
.resideInAnyPackage(MatchingPattern.SHARED_CORE, MatchingPattern.NESTJS_COMMON) | ||
.because("Core should not depend on any other dependencies") | ||
.check(srcProject.allClasses()); | ||
}); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
export enum MatchingPattern { | ||
CORE = "..core..", | ||
INFRA = "..infra..", | ||
|
||
ADMIN_CORE = "src.admin.core..", | ||
ADMIN_USECASE = "src.admin..core..useCase..", | ||
ADMIN_INFRA = "src.admin..infra..", | ||
ADMIN_REPOSITORY = "src.admin..infra..repository..", | ||
|
||
NOTIFICATION_CORE = "src.notification.core..", | ||
|
||
SHARED_CORE = "..shared.core..", | ||
|
||
NESTJS_COMMON = "@nestjs.common", | ||
NESTJS_TESTING = "@nestjs.testing", | ||
|
||
SNU_LIB = "packages", | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.