alexfacciorusso
10/18/2020, 1:57 PMJavier
10/18/2020, 3:20 PMwasyl
10/18/2020, 4:19 PM@AutoScan
object InstantTaskExecutorListener : TestListener {
override suspend fun prepareSpec(kclass: KClass<out Spec>) {
ArchTaskExecutor.getInstance().setDelegate(object : TaskExecutor() {
override fun executeOnDiskIO(runnable: Runnable) {
runnable.run()
}
override fun postToMainThread(runnable: Runnable) {
runnable.run()
}
override fun isMainThread(): Boolean {
return true
}
})
}
override suspend fun finalizeSpec(kclass: KClass<out Spec>, results: Map<TestCase, TestResult>) {
ArchTaskExecutor.getInstance().setDelegate(null)
}
}
Is the new one better somehow?LeoColman
10/18/2020, 4:33 PMalexfacciorusso
10/18/2020, 4:49 PMwasyl
10/18/2020, 5:13 PMalexfacciorusso
10/18/2020, 5:17 PMalexfacciorusso
10/19/2020, 8:10 AMalexfacciorusso
10/19/2020, 9:59 AMJavier
10/19/2020, 10:02 AMalexfacciorusso
10/19/2020, 12:38 PMalexfacciorusso
10/19/2020, 12:41 PMTestObserver
from https://github.com/jraska/livedata-testing, rewriting it completely in Kotlin and exposing that class in the LiveData matcher, so that we can do things like:
liveData.testing { it: TestObserver ->
it shouldHaveValue 1
someOtherAction()
it shouldHaveHistory listOf(1,2)
}
that might be one idea, but I need inputs on this, what do we would preferalexfacciorusso
10/19/2020, 12:43 PMTestObserver
class instead than on the LiveData
directly, since doing so instead would limit the possibilities we have to test, for example, the history of the livedata valuesJavier
10/19/2020, 12:44 PMalexfacciorusso
10/19/2020, 12:44 PMJavier
10/19/2020, 12:45 PMflowOf("one", "two").test {
assertEquals("one", expectItem())
assertEquals("two", expectItem())
expectComplete()
}
alexfacciorusso
10/19/2020, 12:45 PMsam
10/19/2020, 1:37 PMalexfacciorusso
10/19/2020, 1:38 PMsam
10/19/2020, 1:38 PMsam
10/19/2020, 1:40 PMJavier
10/19/2020, 1:43 PMalexfacciorusso
10/19/2020, 1:43 PMBehaviourSubject
in Rx if you’re familiar with it, or in general is a class notifying an observer that something in it has changed, and usually keeps its latest value in memoryalexfacciorusso
10/19/2020, 1:43 PMsam
10/19/2020, 1:43 PMalexfacciorusso
10/19/2020, 1:44 PMsam
10/19/2020, 1:45 PMJavier
10/19/2020, 1:45 PMalexfacciorusso
10/19/2020, 1:46 PMsam
10/19/2020, 1:46 PMalexfacciorusso
10/19/2020, 1:46 PMsam
10/19/2020, 1:47 PMsam
10/19/2020, 1:48 PMalexfacciorusso
10/19/2020, 1:59 PMsam
10/19/2020, 1:59 PMalexfacciorusso
11/05/2020, 8:48 AMalexfacciorusso
11/05/2020, 8:48 AMalexfacciorusso
11/05/2020, 8:48 AMsam
11/05/2020, 10:49 AM