Skip to main content

Class: Conditions<Context, S>

Type parameters

NameType
Contextextends ConditionsContextBase<S>
SContext["state"]

Hierarchy

  • Function

    Conditions

Callable

Conditions

Conditions(errorMessage?): ConditionsMethods<Context, S>

Provide custom error message. It will be sent to the client when one of the assertions fail in given chain.

TODO: it would be nice to have an object or error code sent to client additionally. Front-end could then have it pick the message in player's language

Example

test("Wait for your turn!").itsPlayersTurn()
test("Can't perform this action until round 5").its("round").is.aboveEq(5)

Parameters

NameType
errorMessage?string

Returns

ConditionsMethods<Context, S>

Constructors

constructor

new Conditions<Context, S>(context, defaultSubjectKey?)

Type parameters

NameType
Contextextends ConditionsContextBase<S>
Sextends State<Record<string, unknown>, S> = Context["state"]

Parameters

NameType
contextContext
defaultSubjectKey?keyof Context

Overrides

Function.constructor