package com.sksamuel.kt.koin

import io.kotest.assertions.throwables.shouldThrowAny
import io.kotest.core.spec.style.ShouldSpec
import org.koin.dsl.module
import org.koin.test.check.checkModules

class CheckModulesTest : ShouldSpec({

   should("Enable check modules") {
      checkModules {
         modules(koinModule)
      }
   }

   should("Throw exception if module is incomplete") {
      shouldThrowAny {
         checkModules {
            modules(incompleteModule)
         }
      }
   }

})

private val incompleteModule = module {
   single { RepoUser(get()) }
}

private class RepoUser(
   private val repo: Repo
)

// Not defined in Koin
private class Repo

Add a test for Koin `checkModules`
Add a test for Koin `checkModules`

At Koin's documentation, one can test that all the modules are setup correctly. However,
the docs only have a guide on doing that with a JUnit extension, and within a JUnit test:
https://start.insert-koin.io/#/getting-started/testing?id=checking-your-modules

This commit adds a test to ensure Kotest fails that assertion correctly. No implementation is necessary
as it already works out of the box.

sksamuel/ktest