Skip to content

Commit

Permalink
check unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
stslex committed Aug 1, 2023
1 parent 165d75b commit 34bebce
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class InitialAppViewModel(
val isAuth: StateFlow<Boolean?>
get() = _isAuth.asStateFlow()

// TODO (вынести из init блока)
init {
dataStore.token
.catch { error ->
Expand Down
19 changes: 16 additions & 3 deletions app/src/test/java/com/stslex/aproselection/DiKoinModuleTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@ package com.stslex.aproselection

import android.content.Context
import com.stslex.aproselection.core.datastore.coreDataStoreModule
import com.stslex.aproselection.core.network.di.ModuleCoreNetwork
import com.stslex.aproselection.core.network.di.ModuleCoreNetwork.moduleCoreNetwork
import com.stslex.aproselection.core.ui.navigation.NavigationScreen
import com.stslex.aproselection.di.appModule
import com.stslex.aproselection.feature.auth.di.ModuleFeatureAuth.moduleFeatureAuth
import com.stslex.aproselection.feature.home.di.moduleFeatureHome
import org.junit.Test
import org.koin.android.ext.koin.androidContext
import org.koin.dsl.koinApplication
import org.koin.dsl.module
import org.koin.test.KoinTest
import org.koin.test.check.checkModules
import org.mockito.Mockito
Expand All @@ -16,12 +19,22 @@ class DiKoinModuleTest : KoinTest {

@Test
fun checkKoinModules() {
val navigator: (screen: NavigationScreen) -> Unit = {}

koinApplication {

androidContext(Mockito.mock(Context::class.java))
modules(
moduleFeatureAuth,
module {
single {
navigator
}
},
appModule,
moduleCoreNetwork,
coreDataStoreModule
coreDataStoreModule,
moduleFeatureAuth,
moduleFeatureHome,
)
checkModules()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ class AppDataStoreImpl(
}
}


override suspend fun setToken(token: String) {
context.dataStore.updateData { prefs ->
prefs.toMutablePreferences().apply {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class NetworkClientImpl(
private val _uuid = MutableStateFlow("")
private val uuid = _uuid.asStateFlow()

// TODO (вынести из init блока)
init {
dataStore.token
.onEach {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ class AuthNetworkClientImpl(
.body()
}


override fun auth(
user: UserAuthSendModel
): Flow<UserAuthResponseModel> = flow {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ class AuthRepositoryImpl(
private val dataSource: AppDataStore
) : AuthRepository {


override fun auth(
username: String,
password: String
Expand Down

0 comments on commit 34bebce

Please sign in to comment.