Billy Newman
06/06/2023, 2:07 PMBilly Newman
06/06/2023, 2:07 PMfun test_separators_are_added_every_10_items() = runTest {
// Create your ViewModel
val viewModel = MyViewModel(
myRepository = FakeMyRepository()
)
// Get the Flow of PagingData from the ViewModel with the separator transformations applied
val items: Flow<PagingData<String>> = viewModel.items
val snapshot: List<String> = items.asSnapshot(coroutineScope = this) {}
// With the asSnapshot complete, you can now verify that the snapshot
// has the expected separators
}
Is there an issue with my kotlin coroutines version, maybe the example code is using a older version?Ian Lake
06/06/2023, 7:49 PMpaging-testing
artifact. Did you add a dependency on that artifact? The current version is 3.2.0-alpha06