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

Add support for scope linking in checkModules #1306

Conversation

Pfoerd
Copy link
Contributor

@Pfoerd Pfoerd commented Mar 2, 2022

Enables "simulation" of linked scopes in checkModules. Thus, we don't have to explicitly provide default values for all of the injected instances coming from other scopes.

val myModule = module {
    scope(named("scope1")) {
        scoped { ComponentA() }
    }
    scope(named("scope2")) {
        scoped { ComponentB(get()) }
    }
}

scope2.linkTo(scope1)
scope2.get<ComponentB>()
@Test
fun `test DI modules`(){
    koinApplication {
        modules(myModule)
        checkModules(){
            withScopeLink(named("scope2"), named("scope1"))
        }
    }
}

@Pfoerd Pfoerd force-pushed the fix/full_scope_support_for_check_modules branch from 37a6e34 to 74702c7 Compare March 2, 2022 15:37
@arnaudgiuliani arnaudgiuliani added core test status:checking currently in analysis - discussion or need more detailed specs labels Mar 22, 2022
@arnaudgiuliani
Copy link
Member

Interesting, thanks.

@arnaudgiuliani arnaudgiuliani added this to the 3.2.0 milestone Mar 22, 2022
@arnaudgiuliani arnaudgiuliani added status:accepted accepted to be developed and removed status:checking currently in analysis - discussion or need more detailed specs labels Apr 27, 2022
@arnaudgiuliani
Copy link
Member

Good job

@arnaudgiuliani arnaudgiuliani merged commit f7cb99f into InsertKoinIO:main Apr 30, 2022
arnaudgiuliani added a commit that referenced this pull request Apr 30, 2022
…or_check_modules"

This reverts commit f7cb99f, reversing
changes made to 69a4898.
@Pfoerd Pfoerd deleted the fix/full_scope_support_for_check_modules branch May 24, 2022 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core status:accepted accepted to be developed test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants