Code snippets employed to ensure the uniformity of tests written with Kotest library.
class UseCaseTest : FreeSpec({
"UseCase has test class" {
Konsist
.scopeFromProject()
.classes()
.withNameEndingWith("UseCase")
.assertTrue(testName = this.testCase.name.testName) { it.hasTestClass() }
}
})
class UseCaseTests : FreeSpec({
Konsist
.scopeFromProject()
.classes()
.withNameEndingWith("UseCase")
.forEach { useCase ->
"${useCase.name} should have test" {
useCase.assertTrue(testName = this.testCase.name.testName) { it.hasTestClass() }
}
"${useCase.name} should reside in ..domain..usecase.. package" {
useCase.assertTrue(testName = this.testCase.name.testName) { it.resideInPackage("..domain..usecase..") }
}
"${useCase.name} should ..." {
// another Konsist assert
}
}
})