Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix verify API dependency #1807

Merged
merged 1 commit into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ class Simple {

class CycleAB(val b: CycleBA)
class CycleBA(val a: CycleAB)

class MyComplexBool(val a : ComponentA, val b : Boolean)

fun buildB(a: ComponentA) : MyComponentB = ComponentB(a)
}

object UpperCase : Qualifier {
Expand Down
22 changes: 22 additions & 0 deletions projects/core/koin-test/src/jvmTest/kotlin/VerifyModulesTest.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import org.koin.core.logger.Level
import org.koin.core.module.dsl.factoryOf
import org.koin.core.module.dsl.singleOf
import org.koin.core.qualifier.named
import org.koin.dsl.bind
import org.koin.dsl.koinApplication
import org.koin.dsl.module
import org.koin.test.Simple
import org.koin.test.check.checkModules
import org.koin.test.verify.CircularInjectionException
import org.koin.test.verify.MissingKoinDefinitionException
import org.koin.test.verify.Verify
Expand Down Expand Up @@ -162,4 +166,22 @@ class VerifyModulesTest {
System.err.println("$e")
}
}

@Test
fun `verify dependency and param in one class - 3`() {
val modules = module {
factory { p -> Simple.MyComplexBool(get(), p.get()) }
}

modules.verify(extraTypes = listOf(Simple.ComponentA::class, Boolean::class))
}

@Test
fun `verify function builder`() {
val modules = module {
factoryOf(Simple::buildB)
}

modules.verify(extraTypes = listOf(Simple.ComponentA::class))
}
}