https://kotlinlang.org logo
z

ziv kesten

12/31/2020, 7:28 AM
I am trying to test my VM which uses paging with
paging_compose_version = '1.0.0-alpha04'
In my unit test i am getting
Flow<PagingData<MyObject>
from the VM, it would be supplied by a fake repository implementation using
PagingData.from(mockList)
However i cant seem to compare the PagingData objects. Here is the test:
Copy code
@Test
fun testPopularShowsPagedDataflow() = mainCoroutineRule.testDispatcher.runBlockingTest {

    //Collect
    val popularShowsPagedData: PagingData<Show> = sut.popularShowsPagedData.first()

    //Assert                                     // PagingData.from(mockList)
                                                            |
                                                            v
    assertThat("list", popularShowsPagedData == mockPagingDataOfPopularShows)
}
I tried the solution suggested at https://stackoverflow.com/questions/63522656/what-is-the-correct-way-to-check-the-data-from-a-pagingdata-object-in-android-un But it does not seem to work anymore, throwing:
Missing call to onListPresentable after new list was presented. If you are seeing this exception, it is generally an indication of an issue with Paging. Please file a bug so we can fix it at: <https://issuetracker.google.com/issues/new?component=413106>
@Ian Lake