//workflow/com.squareup.workflow1.testing/expectWorker
expectWorker¶
[jvm]
Content
inline fun <PropsT, StateT, OutputT, RenderingT, WorkerOutputT, WorkerT : Worker<WorkerOutputT>> RenderTester<PropsT, StateT, OutputT, RenderingT>.expectWorker(expected: WorkerT, key: String = “”, output: WorkflowOutput<WorkerOutputT>? = null, description: String = “”): RenderTester<PropsT, StateT, OutputT, RenderingT>
More info
Specifies that this render pass is expected to run a Worker that has the same type of the given worker and for which the actual worker’s doesSameWorkAs method returns true. If a worker is ran that matches the type of expected, but the actual worker’s doesSameWorkAs returns false, then an AssertionError will be thrown. If you need to perform custom assertions, use the overload of this method that takes an assertWhen parameter.
Parameters¶
jvm
expected | Worker passed to the actual worker’s doesSameWorkAs method to assert the worker matches. |
key | The key passed to runningWorker when rendering this workflow. |
output | If non-null, WorkflowOutput.value will be emitted when this worker is ran. The WorkflowAction used to handle this output can be verified using methods on RenderTestResult. |
description | Optional string that will be used to describe this expectation in error messages. |
[jvm]
Content
inline fun <PropsT, StateT, OutputT, RenderingT, WorkerOutputT, WorkerT : Worker<WorkerOutputT>> RenderTester<PropsT, StateT, OutputT, RenderingT>.expectWorker(workerClass: KClass
More info
Specifies that this render pass is expected to run a Worker with the given workerClass. The worker’s output type is not taken into consideration.
Parameters¶
jvm
workerClass | The KClass of the worker that is expected to be run. |
key | The key passed to runningWorker when rendering this workflow. |
assertWorker | A function that will be passed the actual worker that matches this expectation and can perform custom assertions on the worker instance. |
output | If non-null, WorkflowOutput.value will be emitted when this worker is ran. The WorkflowAction used to handle this output can be verified using methods on RenderTestResult. |
description | Optional string that will be used to describe this expectation in error messages. |
[jvm]
Content
fun <PropsT, StateT, OutputT, RenderingT> RenderTester<PropsT, StateT, OutputT, RenderingT>.expectWorker(workerType: KType, key: String = “”, assertWorker: (Worker<>) -> Unit = {}, output: WorkflowOutput<>? = null, description: String = “”): RenderTester<PropsT, StateT, OutputT, RenderingT>
More info
Specifies that this render pass is expected to run a Worker whose KType matches workerType.
Parameters¶
jvm
workerType | The KType of the Worker that is expected to be run. This will be compared against the concrete type of the worker that is passed to com.squareup.workflow.runningWorker, but may be a supertype of that type. E.g. an expected worker type of typeOf
|
key | The key passed to runningWorker when rendering this workflow. |
assertWorker | A function that will be passed the actual worker that matches this expectation and can perform custom assertions on the worker instance. |
output | If non-null, WorkflowOutput.value will be emitted when this worker is ran. The WorkflowAction used to handle this output can be verified using methods on RenderTestResult. |
description | Optional string that will be used to describe this expectation in error messages. |