1

I am trying test room dao that return paging source but it does not work , it freeze at the adapter or sometimes it returns null

 val differ = AsyncPagingDataDiffer(
                diffCallback = MyDiffCallback(),
                updateCallback = NoopListCallback(),
                workerDispatcher = Dispatchers.Main
            )
    
            val job = launch {
                val result =
                    Pager(config = PagingConfig(10) , initialKey = null) {
                        localRepositoryTicket.fetchTicketParentsListExcept(customerId,projectId,"123","water")
    
                    }.flow
    
                result.collectLatest {
                    differ.submitData(it)
                }
    
            }
            advanceUntilIdle()
            Assert.assertEquals(differ.snapshot().items[0].subject,"water damagexx")
            Assert.assertEquals(differ.snapshot().items[0].sequentialId,3)
    
            job.cancel()

0 Answers0