Class MediatorNumber<A, I, T, O, TS>

A mediator that can mediate over a single number field.

It takes the required 'field' and 'type' parameters. The 'field' parameter represents the field name of the test result field over which must be mediated. The 'type' parameter

Type Parameters

Hierarchy (View Summary)

Implements

Constructors

Properties

bus: Bus<A, I, T, O, TS>

The bus this mediator will mediate over.

field: string

The field name of the test result field over which must be mediated.

ignoreFailures: boolean

If actors that throw fail tests should be ignored

indexPicker: (tests: T[]) => number
name: string

The name for this mediator.

{<rdf:subject>}
type: "min" | "max"

The way how the index should be selected. For choosing the minimum value: 'min'. For choosing the maximum value: 'max'.

Methods

  • Protected

    Construct a human-friendly failure message that accumulates the given actors's failure messages.

    Parameters

    • action: I

      The action that was executed.

    • actorFailures: string[]

      The failure messages that were collected from actor tests based on the given executed action.

    Returns string

  • Returns (tests: (undefined | T)[]) => number

    A function that returns the index of the test result that has been chosen by this mediator.

  • Mediate for the given action.

    This will send the test action on all actors in the bus. The action will be run on the actor that tests best, of which the result will be returned.

    Parameters

    • action: I

      The action to mediate for.

    Returns Promise<O>

    A promise that resolves to the mediation result.

  • Mediate for the given action to get an actor.

    This will send the test action on all actors in the bus. The actor that tests best will be returned.

    Parameters

    • action: I

      The action to mediate for.

    Returns Promise<TestResult<A, TS>>

    A promise that resolves to the best actor.

  • Mediate for the given action.

    This will send the test action on all actors in the bus. The action will be run on the actor that tests best, of which the result will be returned.

    Parameters

    • action: I

      The action to mediate for.

    Returns Promise<TestResult<O, TS>>

    A promise that resolves to the mediation result.

  • Mediate for the given action with the given actor test results for the action.

    One actor must be returned that provided the best test result. How 'best' is interpreted, depends on the implementation of the Mediator.

    Parameters

    • action: I

      The action to mediate for.

    • testResults: IActorReply<A, I, T, O, TS>[]

      The actor test results for the action.

    Returns Promise<TestResult<A, TS>>

    A promise that resolves to the best actor.