Function fakeProvider
-
fakeProvider<W extends Workflow, T>(
instance: WorkflowInstance<W>,
name: string,
service: ServiceType<T>,
fake: (provide: Provide<T>) => Provided<T> | Promise<Provided<T>>,
): WorkflowInstance<W>Type Parameters
- W extends Workflow
- T
The type of the service.
Parameters
- instance: WorkflowInstance<W>
- name: string
- service: ServiceType<T>
- fake: (provide: Provide<T>) => Provided<T> | Promise<Provided<T>>
Returns WorkflowInstance<W>
Puts
fakein place of the function of the workflow's service provider namedname, for the journey ofinstancealone, replacing any fake given before for that provider, and returnsinstance.Only the provider's function is replaced. It keeps its scope, the steps it serves and what it requests: the executor still resolves its requests first, so missing data aborts the journey as without a fake, then calls
fakewherever it would call the provider, once per journey or once per attempt.fakereturns whatprovidemakes, or a promise of it, and a fake that throws, or rejects, aborts the journey as the provider would.service_providednames the implementationfakemade. The workflow's declaration, its admission and its listing are unchanged.