square / workflow-kotlin

A Swift and Kotlin library for making composable state machines, and UIs driven by those state machines.

Home Page:https://square.github.io/workflow

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SessionWorkflow throws when trying to unit test it with RenderTester#testRender

antoniorosario opened this issue · comments

When trying to unit test a Workflow that inherits from SessionWorkflow using RenderTester#testRender I get this error:

SessionWorkflow should never call initialState without the CoroutineScope.
java.lang.IllegalStateException: SessionWorkflow should never call initialState without the CoroutineScope.
at com.squareup.workflow1.SessionWorkflow.initialState(SessionWorkflow.kt:82)
at com.squareup.workflow1.testing.RenderTesterKt.testRender(RenderTester.kt:29)

It looks like RenderTester#testRender is calling an overloaded initialState method that SessionWorkflow doesn't support, see

public final override fun initialState(
props: PropsT,
snapshot: Snapshot?
): StateT {
error("SessionWorkflow should never call initialState without the CoroutineScope.")
}
}
.