expectWorkflow
Specifies that this render pass is expected to render a particular child workflow.
Workflow identifiers are compared taking the type hierarchy into account. When a workflow is rendered, it will match any expectation that specifies the type of that workflow, or any of its supertypes. This means that if you have a workflow that is split into an interface and a concrete class, your render tests can pass the class of the interface to this method instead of the actual class that implements it.
Expecting impostor workflows
If the workflow-under-test renders an ImpostorWorkflow, the match will not be performed using the impostor type, but rather the real identifier of the impostor's WorkflowIdentifier. This will be the last identifier in the chain of impostor workflows' realIdentifiers.
A workflow that is wrapped multiple times by various operators will be matched on the upstream workflow, so for example the following expectation would succeed:
val workflow = Workflow.stateless<…> {
renderChild(
childWorkflow.mapRendering { … }
.mapOutput { … }
)
}
workflow.testRender(…)
.expectWorkflow(childWorkflow::class, …)
Parameters
The WorkflowIdentifier of the expected workflow. May identify any supertype of the actual rendered workflow, e.g. if the workflow type is an interface and the workflow-under-test injects a fake.
The rendering to return from renderChild when this workflow is rendered.
The key passed to renderChild when rendering this workflow.
A function that performs assertions on the props passed to renderChild.
Optional string that will be used to describe this expectation in error messages.
Specifies that this render pass is expected to render a particular child workflow.
Workflow identifiers are compared taking the type hierarchy into account. When a workflow is rendered, it will match any expectation that specifies the type of that workflow, or any of its supertypes. This means that if you have a workflow that is split into an interface and a concrete class, your render tests can pass the class of the interface to this method instead of the actual class that implements it.
Expecting impostor workflows
If the workflow-under-test renders an ImpostorWorkflow, the match will not be performed using the impostor type, but rather the real identifier of the impostor's WorkflowIdentifier. This will be the last identifier in the chain of impostor workflows' realIdentifiers.
A workflow that is wrapped multiple times by various operators will be matched on the upstream workflow, so for example the following expectation would succeed:
val workflow = Workflow.stateless<…> {
renderChild(
childWorkflow.mapRendering { … }
.mapOutput { … }
)
}
workflow.testRender(…)
.expectWorkflow(childWorkflow::class, …)
Parameters
The WorkflowIdentifier of the expected workflow. May identify any supertype of the actual rendered workflow, e.g. if the workflow type is an interface and the workflow-under-test injects a fake.
The rendering to return from renderChild when this workflow is rendered.
The key passed to renderChild when rendering this workflow.
A function that performs assertions on the props passed to renderChild.
If non-null, WorkflowOutput.value will be "emitted" when this workflow is rendered. The WorkflowAction used to handle this output can be verified using methods on RenderTestResult.
Optional string that will be used to describe this expectation in error messages.
Specifies that this render pass is expected to render a particular child workflow.
Workflow identifiers are compared taking the type hierarchy into account. When a workflow is rendered, it will match any expectation that specifies the type of that workflow, or any of its supertypes. This means that if you have a workflow that is split into an interface and a concrete class, your render tests can pass the class of the interface to this method instead of the actual class that implements it.
Expecting impostor workflows
If the workflow-under-test renders an ImpostorWorkflow, the match will not be performed using the impostor type, but rather the real identifier of the impostor's WorkflowIdentifier. This will be the last identifier in the chain of impostor workflows' realIdentifiers.
A workflow that is wrapped multiple times by various operators will be matched on the upstream workflow, so for example the following expectation would succeed:
val workflow = Workflow.stateless<…> {
renderChild(childWorkflow.mapRendering { … })
}
workflow.testRender(…)
.expectWorkflow(childWorkflow::class, …)
Parameters
The KClass of the expected workflow. May also be any of the supertypes of the expected workflow, e.g. if the workflow type is an interface and the workflow-under-test injects a fake.
The rendering to return from renderChild when this workflow is rendered.
The key passed to renderChild when rendering this workflow.
A function that performs assertions on the props passed to renderChild.
If non-null, WorkflowOutput.value will be "emitted" when this workflow is rendered. The WorkflowAction used to handle this output can be verified using methods on RenderTestResult.
Optional string that will be used to describe this expectation in error messages.