Class EntryRecordingReporter
Hierarchy (View Summary)
- RecordingReporter
- EntryRecordingReporter
Constructors
constructor
-
Returns EntryRecordingReporter
Accessors
entries
-
Every entry of global metadata it has received so far, in order.
Returns readonly GlobalMetadataEntry[]
events
-
Every event it has received so far, in the order it received them.
Returns readonly Event[]
global Metadata
-
The global metadata it has received so far: each key with its latest value, in the order the keys were first set. The journey ID is the first entry, under
journey_id.Returns ReadonlyMap<string, PlainValue>
path
-
get path(): readonly string[]
The path of the journey so far: one line for each event of its flow, in the order it received them, so that a test can compare it with the path it expects, or with an approved file through
path.join("\n").Only the flow has lines: the outcome of each attempt, each decision on a step, and how the journey ended. Inputs, services, hooks, contributions, the events steps, hooks and service providers emit, and global metadata have none, and no line holds a timestamp, a sequence number or an ID, so a path changes only when the flow does. The lines read:
charge attempt 1 succeeded;charge attempt 1 failed: declined, with the reason's code;charge attempt 1 skipped, with:and the reason's code when it has one; andcharge attempt 1 terminated abnormally: timeout, with the error's message. A rescue step's attempts read the same under its own name, such ascharge_rescue.charge retrying;charge given up: retries exhausted, or the other cause,failureorabnormal termination; andcharge given up: FailWorkflow from fraud_checkwhen a hook of the policyfraud_checkgave it up.charge rescuing with charge_rescueandcharge rescued by charge_rescue.journey succeeded, orjourney succeeded, decided by early_exitwhen a hook of the policyearly_exitdecided it;journey failed at charge: declined, with the code of the reason the journey failed for, or the error's message when there is no reason; andjourney aborted at charge: step could not be built, with the abort reason, orjourney aborted: reporter failedwhen the abort concerns no step.
A refused journey has no events, so its path is empty.
Returns readonly string[]
Methods
receive Global Metadata
-
Keeps the entry, after every entry received before it.
Parameters
- key: string
- value: PlainValue
Returns void
A recording reporter that also keeps every entry of global metadata it receives, in order, each with the kind of the event it received last before it, so that a test can check when an entry was set, and every value a key was given, not only the latest. Like RecordingReporter, it never fails.