Asserter
Hierarchy
- Asserter
Implements
- Asserter
- Asserter
Index
Constructors
Methods
- assert
- clearAction
- getAction
- getApi
- getAssertions
- getEntity
- hasAction
- hasApi
- hasAssertion
- registerAssertion
- setAction
- setEntity
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 | MessageType‹Message› | undefined
Implementation of Asserter
Gets action for which assertion is being made.
Returns: Stringifiable | MessageType‹Message› | 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:
Name | Type |
---|---|
pathOrPartial | any |
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:
Name | Type |
---|---|
assertionCtor | any |
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:
Name | Type | Description |
---|---|---|
assertion | Assertion | Instance implementing Assertion interface. |
Returns: void
setAction
▸ setAction(action
: Stringifiable): void
Sets the action for which assertion is being made.
Parameters:
Name | Type | Description |
---|---|---|
action | Stringifiable | Action name or type implementing MessageableType . |
Returns: void
setEntity
▸ setEntity(entity
: Entity): void
Implementation of Asserter
Sets the Entity
target of assertions.
Parameters:
Name | Type | Description |
---|---|---|
entity | Entity | Entity or subclass instance. |
Returns: void