Skip to content

Commit 58f791c

Browse files
committed
fix: correct unit test assertions and deprecation warnings
- Fix DownloadableModelLocalDataSourceTest: CustomOnnx models should have downloaded=false (implementation returns false for custom models) - Replace deprecated createTempDir() with kotlin.io.path.createTempDirectory() in ScanCustomModelsUseCaseImplTest
1 parent ff52679 commit 58f791c

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

data/src/test/java/dev/minios/pdaiv1/data/local/DownloadableModelLocalDataSourceTest.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ class DownloadableModelLocalDataSourceTest {
111111

112112
val expected = buildList {
113113
addAll(mockLocalModelEntities.mapEntityToDomain())
114-
add(LocalAiModel.CustomOnnx.copy(downloaded = true))
114+
add(LocalAiModel.CustomOnnx.copy(downloaded = false))
115115
}
116116

117117
localDataSource
@@ -143,7 +143,7 @@ class DownloadableModelLocalDataSourceTest {
143143
.getAllOnnx()
144144
.test()
145145
.assertNoErrors()
146-
.assertValue(listOf(LocalAiModel.CustomOnnx.copy(downloaded = true)))
146+
.assertValue(listOf(LocalAiModel.CustomOnnx.copy(downloaded = false)))
147147
.await()
148148
.assertComplete()
149149
}
@@ -331,15 +331,15 @@ class DownloadableModelLocalDataSourceTest {
331331

332332
stubObserver
333333
.assertNoErrors()
334-
.assertValueAt(0, listOf(LocalAiModel.CustomOnnx.copy(downloaded = true)))
334+
.assertValueAt(0, listOf(LocalAiModel.CustomOnnx.copy(downloaded = false)))
335335

336336
stubLocalModels.onNext(mockLocalModelEntities)
337337

338338
stubObserver
339339
.assertNoErrors()
340340
.assertValueAt(1, buildList {
341341
addAll(mockLocalModelEntities.mapEntityToDomain())
342-
add(LocalAiModel.CustomOnnx.copy(downloaded = true))
342+
add(LocalAiModel.CustomOnnx.copy(downloaded = false))
343343
})
344344
}
345345

domain/src/test/java/dev/minios/pdaiv1/domain/usecase/downloadable/ScanCustomModelsUseCaseImplTest.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import org.junit.After
88
import org.junit.Before
99
import org.junit.Test
1010
import java.io.File
11+
import kotlin.io.path.createTempDirectory
1112

1213
class ScanCustomModelsUseCaseImplTest {
1314

@@ -18,7 +19,7 @@ class ScanCustomModelsUseCaseImplTest {
1819

1920
@Before
2021
fun setUp() {
21-
tempDir = createTempDir("scan_custom_models_test")
22+
tempDir = createTempDirectory("scan_custom_models_test").toFile()
2223
}
2324

2425
@After

0 commit comments

Comments
 (0)