Updated on 2026-08-14

This commit is contained in:
Tangem 2026-03-11 12:19:46 +03:00
parent f77389cd31
commit 863d12763d
4 changed files with 58 additions and 19 deletions

View file

@ -5,6 +5,7 @@ import com.squareup.moshi.JsonAdapter
import com.squareup.moshi.Moshi
import com.squareup.moshi.Types
import com.squareup.moshi.adapter
import com.tangem.core.analytics.api.AnalyticsExceptionHandler
import com.tangem.datasource.api.express.models.response.Asset
import com.tangem.datasource.asset.reader.AssetReader
import com.tangem.utils.coroutines.TestingCoroutineDispatcherProvider
@ -23,9 +24,11 @@ class AssetLoaderTest {
private val assetReader = mockk<AssetReader>()
private val moshi = mockk<Moshi>()
private val analyticsExceptionHandler = mockk<AnalyticsExceptionHandler>()
private val assetLoader = AssetLoader(
assetReader = assetReader,
moshi = moshi,
analyticsExceptionHandler = analyticsExceptionHandler,
dispatchers = TestingCoroutineDispatcherProvider(),
)

View file

@ -18,7 +18,7 @@ internal class AndroidAssetReaderTest {
@Test
fun read_content() = runTest {
every { assetManager.open(FILE_NAME) } returns json.byteInputStream()
every { assetManager.open(FILE_NAME, AssetManager.ACCESS_BUFFER) } returns json.byteInputStream()
val actual = assetReader.read(fullFileName = FILE_NAME)
@ -28,7 +28,7 @@ internal class AndroidAssetReaderTest {
@Test
fun read_error() = runTest {
val exception = IOException("Error")
every { assetManager.open(FILE_NAME) } throws exception
every { assetManager.open(FILE_NAME, AssetManager.ACCESS_BUFFER) } throws exception
runCatching { assetReader.read(fullFileName = FILE_NAME) }
.onSuccess { throw IllegalStateException("Error should be thrown") }