expectCovariantWorkflow
Parameters
The KClass of the expected workflow or one of its supertypes, including covariant supertypes. E.g. if the workflow type is an interface and the workflow-under-test injects a fake.
The number of 'levels' of generic arguments to verify in the OutputT, e.g., for Wrapper<*>
and level 1 only Wrapper
would be checked, whereas for level 2, Wrapper
and *
(the star projection) would be checked against the RenderChildInvocation.
The KType of the RenderingT of the expected child workflow.
The number of 'levels' of generic arguments to verify in the OutputT, e.g., for Wrapper<*>
and level 1 only Wrapper
would be checked, whereas for level 2, Wrapper
and *
(the star projection) would be checked against the RenderChildInvocation.
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.
See also
for more on this expectation.
This is a special use version for when the only reasonable KClass you have to verify against is the definition of a workflow whose OutputT and RenderingT are supertypes of the OutputT and RenderingT of the child workflow type you expect to be rendered. In other words, the expected workflow is covariant with the class you have to pass to the expectation. (There is a slight nuance here, in that if the OutputT is a supertype of the expected child's OutputT, then those workflow's are not actually covariant since OutputT is an invariant generic type. This is not important for the use of this expectation, however.)
The most common need for this is when you are using a generic factory to construct Workflow instances that you then wish to expect in your test.
In that case, use this expectation and provide the KClass of the Workflow type, along with the KType of the OutputT and RenderingT. The PropsT can simply be verified for type safety inside assertProps by casting the Any? into the expected PropsT.
Note that this implementation does not handle ImpostorWorkflows (for proxied identifiers) like the other versions do.