nicopasso
07/09/2019, 9:06 AMbindingCatch to compose a sequence of actions (API call, db call etc). What’s the best way to test it and to assure the actions are executed?raulraja
07/09/2019, 9:35 AMnicopasso
07/09/2019, 9:48 AMnicopasso
07/09/2019, 9:48 AM.bind() part without success thoughImran/Malic
07/09/2019, 12:34 PMnicopasso
07/09/2019, 12:52 PM//UseCase.kt
fun sync() {
binding<Error, List<T>> {
//myList() returns Either<Error, List<A>>
val myList = myRepo.getList().bind()
val localIds = myList.map { it.id }
// getCustomersByIds() returns Either<Error, List<T>>
val customersE = myRepo.getCustomersByIds(localIds)
customersE
}.fix()
}nicopasso
07/09/2019, 12:52 PM@ Test
fun `test binding`() {
runBlocking { //because of coroutines and stuff
whenever(myRepo).getList().thenReturn(aList)
//here the test fails
}
}nicopasso
07/09/2019, 1:00 PMbind() is what actually falis the testraulraja
07/09/2019, 10:35 PMraulraja
07/09/2019, 10:36 PMraulraja
07/09/2019, 10:37 PMraulraja
07/09/2019, 10:38 PMnicopasso
07/10/2019, 6:02 AMraulraja
07/10/2019, 5:16 PM