fix: address PR review comments for Kotlin/Android/KMP docs

This commit is contained in:
ali
2026-03-06 23:17:01 +01:00
committed by Affaan Mustafa
parent f10d638bfa
commit 8961f24821
6 changed files with 40 additions and 21 deletions

View File

@@ -68,8 +68,8 @@ Single responsibility, `operator fun invoke`:
```kotlin
class GetItemsUseCase(private val repository: ItemRepository) {
suspend operator fun invoke(filter: Filter): Result<List<Item>> {
return repository.getAll(filter)
suspend operator fun invoke(id: String): Result<Item> {
return repository.getById(id)
}
}
```

View File

@@ -19,7 +19,8 @@ paths:
```kotlin
@Test
fun `loading state emitted then data`() = runTest {
val repo = FakeItemRepository(items = listOf(testItem))
val repo = FakeItemRepository()
repo.addItem(testItem)
val viewModel = ItemListViewModel(GetItemsUseCase(repo))
viewModel.state.test {
@@ -119,7 +120,7 @@ fun `delete item emits updated list without deleted item`() = runTest { }
```
src/
├── commonTest/kotlin/ # Shared tests (ViewModel, UseCase, Repository)
├── androidTest/kotlin/ # Android unit tests (JUnit)
├── androidUnitTest/kotlin/ # Android unit tests (JUnit)
├── androidInstrumentedTest/kotlin/ # Instrumented tests (Room, UI)
└── iosTest/kotlin/ # iOS-specific tests
```