mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-03-30 13:43:26 +08:00
fix: address PR review comments for Kotlin/Android/KMP docs
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -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
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user