Marko Kunic
12/16/2021, 4:50 PMMarko Kunic
12/16/2021, 5:46 PMMarko Kunic
12/16/2021, 6:15 PMif (environment.config.property("environment").getString() == "test") {
koinModules.add(module { loadTestDependencies() })
}
Marko Kunic
12/16/2021, 6:15 PMarnaud.giuliani
12/17/2021, 9:42 AMMarko Kunic
12/17/2021, 9:43 AMMarko Kunic
12/17/2021, 9:43 AMif there is a config that says we are running tests, we load test module that is predefined
arnaud.giuliani
12/17/2021, 10:23 AMloadKoinModules()
functionMarko Kunic
12/17/2021, 10:44 AMMarko Kunic
12/17/2021, 10:46 AMclass CustomerRoutesTest : KoinTest {
@Test
fun `create a new customer`() {
withApplication(withTestEnvironment()) {
with(
handleAuthenticatedRequest(<http://HttpMethod.Post|HttpMethod.Post>, "/customers") {
setBody(createRequest())
}
) {
assertEquals(Created, response.status())
}
// assert stuff
}
}
}
this is a test, when would I call loadKoinModules
here?arnaud.giuliani
12/17/2021, 10:51 AMMarko Kunic
12/17/2021, 10:51 AMKoinTest
if that helps in any case?Marko Kunic
12/17/2021, 10:52 AMarnaud.giuliani
12/17/2021, 1:26 PM