Skip to content

Commit

Permalink
test: CheckModulesTest
Browse files Browse the repository at this point in the history
  • Loading branch information
jvsena42 committed Oct 24, 2024
1 parent 6ba6fe3 commit a58c385
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
1 change: 1 addition & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ dependencies {
implementation(libs.koin.viewmodel)
implementation(libs.koin.compose)
implementation(libs.koin.android)
implementation(libs.koin.test)
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import com.github.jvsena42.floresta.domain.floresta.FlorestaDaemonImpl
import com.github.jvsena42.floresta.domain.floresta.FlorestaService
import com.github.jvsena42.floresta.presentation.MainViewmodel
import com.github.jvsena42.floresta.presentation.ui.screens.home.HomeViewModel
import org.koin.android.ext.koin.androidApplication
import org.koin.android.ext.koin.androidContext
import org.koin.android.ext.koin.androidLogger
import org.koin.core.context.startKoin
Expand All @@ -33,7 +32,7 @@ class FlorestaApplication : Application() {
}
}

private val presentationModule = module {
val presentationModule = module {
viewModel { MainViewmodel() }
viewModel { HomeViewModel(
walletRepository = get(),
Expand All @@ -42,7 +41,7 @@ private val presentationModule = module {
) }
}

private val domainModule = module {
val domainModule = module {
single {
WalletManager(
dbPath = androidContext().filesDir.toString(),
Expand Down
16 changes: 16 additions & 0 deletions app/src/test/java/com/github/jvsena42/floresta/CheckModulesTest.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.github.jvsena42.floresta

import org.junit.Test
import org.koin.core.annotation.KoinExperimentalAPI
import org.koin.test.KoinTest
import org.koin.test.verify.verify

class CheckModulesTest: KoinTest {

@OptIn(KoinExperimentalAPI::class)
@Test
fun checkAllModules() {
domainModule.verify()
presentationModule.verify()
}
}
1 change: 1 addition & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ koin-core = { module = "io.insert-koin:koin-core" }
koin-android = { module = "io.insert-koin:koin-android" }
koin-viewmodel = { module = "io.insert-koin:koin-core-viewmodel" }
koin-compose = { module = "io.insert-koin:koin-androidx-compose" }
koin-test = { module = "io.insert-koin:koin-test-junit4" }

[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
Expand Down

0 comments on commit a58c385

Please sign in to comment.