-
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.
chore(apiv2): add tarchitecture test
- Loading branch information
Showing
7 changed files
with
537 additions
and
27 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
26 changes: 0 additions & 26 deletions
26
apiv2/src/admin/core/sejours/cle/classe/ClasseService.spec.ts
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,40 @@ | ||
// imports and applies the jest extensions | ||
import "tsarch/dist/jest"; | ||
|
||
// imports the files entrypoint | ||
import { FileConditionBuilder, filesOfProject } from "tsarch"; | ||
import { Folders } from "./folder"; | ||
|
||
describe("architecture", () => { | ||
let files: FileConditionBuilder; | ||
beforeAll(async () => { | ||
// console.log(__filename + "/tsconfig.json"); | ||
// files = filesOfProject(__dirname + "/tsconfig.json"); | ||
files = await filesOfProject("./tsconfig.json"); | ||
}); | ||
// architecture tests can take a while to finish | ||
jest.setTimeout(60000); | ||
|
||
it("business logic should not depend on infra folder", async () => { | ||
const rule = files.matchingPattern(Folders.CORE).shouldNot().dependOnFiles().matchingPattern(Folders.INFRA); | ||
await expect(rule).toPassAsync(); | ||
}); | ||
|
||
it.skip("business logic should exclusively depend on @notification, @shared, snu-lib, @nestjs/common", async () => { | ||
const rule = files | ||
.inFolder(Folders.SRC_CORE) | ||
.should() | ||
.dependOnFiles() | ||
.matchingPattern(`^(snu-lib|common|core)$`); | ||
// .matchingPattern("^(@notification|@shared|snu-lib|@nestjs/common|core)$"); | ||
|
||
// console.log(files.matchingPattern(Folders.SRC_CORE_PATTERN)); | ||
await expect(rule).toPassAsync(); | ||
}); | ||
|
||
it("business logic should be cycle free", async () => { | ||
const rule = files.inFolder(Folders.SRC).should().beFreeOfCycles(); | ||
|
||
await expect(rule).toPassAsync(); | ||
}); | ||
}); |
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,7 @@ | ||
export enum Folders { | ||
SRC = "src", | ||
CORE = "core", | ||
INFRA = "infra", | ||
SRC_CORE_PATTERN = "^(?=.*\bsrc\b)(?=.*\bcore\b)(?!.*.spec.ts$).*", | ||
SRC_CORE = "src/admin/core", | ||
} |
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,3 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
} |
Oops, something went wrong.