Updated on 2026-08-14
This commit is contained in:
parent
09c52231e2
commit
3cc0a643e9
40 changed files with 77 additions and 71 deletions
|
|
@ -1,11 +0,0 @@
|
|||
package com.tangem.common.test
|
||||
|
||||
import com.tangem.utils.coroutines.AppCoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.test.TestScope
|
||||
import kotlin.coroutines.CoroutineContext
|
||||
|
||||
class TestAppCoroutineScope(override val coroutineContext: CoroutineContext = Dispatchers.Unconfined) : AppCoroutineScope {
|
||||
|
||||
constructor(testScope: TestScope) : this(testScope.coroutineContext)
|
||||
}
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
package com.tangem.common.test.datastore
|
||||
|
||||
import androidx.datastore.core.DataStore
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.updateAndGet
|
||||
|
||||
class MockStateDataStore<T>(default: T) : DataStore<T> {
|
||||
|
||||
private val _data = MutableStateFlow(value = default)
|
||||
override val data: Flow<T> = _data
|
||||
|
||||
override suspend fun updateData(transform: suspend (t: T) -> T): T {
|
||||
return _data.updateAndGet { transform(it) }
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue