Asserter

Hierarchy

  • Asserter

Implements

Index

Constructors

Methods

Constructors

constructor

+ new Asserter(): Asserter

Creates an instance of Asserter. Creates an instance of Asserter.

remarks Current implementation of asserting engine is done in singleton fashion to have minimal-to-none impact on performance in comparison to other solutions.

remarks Current implementation of asserting engine is done in singleton fashion to have minimal-to-none impact on performance in comparison to other solutions.

Returns: Asserter

Methods

assert

assert(): any

Implementation of Asserter

Changes type of current instance to any so it can be used on TypeScript.

Returns: any

This instance of Asserter.


clearAction

clearAction(): void

Implementation of Asserter

Clears the action

Returns: void


getAction

getAction(): Stringifiable | MessageTypeMessage› | undefined

Implementation of Asserter

Gets action for which assertion is being made.

Returns: Stringifiable | MessageTypeMessage› | undefined

Action as string or Stringifiable implementation.


getApi

getApi(): Map‹string, Function›

Implementation of Asserter

Returns available api.

Returns: Map‹string, Function›

Mapping of all available methods.


getAssertions

getAssertions(): Assertion[]

Implementation of Asserter

Return registered assertions.

Returns: Assertion[]

List of registered instances of Assertion interface.


getEntity

getEntity(): Entity

Implementation of Asserter

Returns Entity instance target of assertions.

Returns: Entity

Entity instance.


hasAction

hasAction(): boolean

Implementation of Asserter

Evaluates if action is set on asserter.

Returns: boolean

Returns true if action is set on asserter, else false.


hasApi

hasApi(pathOrPartial: any): boolean

Evaluates if explicit or partial api is registered on asserter.

Parameters:

NameType
pathOrPartialany

Returns: boolean

Returns true if api is registered on asserter, else false.


hasAssertion

hasAssertion(assertionCtor: any): boolean

Implementation of Asserter

Evaluates if assertion type is registered on asserter.

Parameters:

NameType
assertionCtorany

Returns: boolean

Returns true if assertion instance is registered on asserter, else false.


registerAssertion

registerAssertion(assertion: Assertion): void

Implementation of Asserter

Registers assertion extension.

Parameters:

NameTypeDescription
assertionAssertionInstance implementing Assertion interface.

Returns: void


setAction

setAction(action: Stringifiable): void

Sets the action for which assertion is being made.

Parameters:

NameTypeDescription
actionStringifiableAction name or type implementing MessageableType.

Returns: void


setEntity

setEntity(entity: Entity): void

Implementation of Asserter

Sets the Entity target of assertions.

Parameters:

NameTypeDescription
entityEntityEntity or subclass instance.

Returns: void