Readonly
contextHolds the current context of the assertion chain execution, this is passed to all scope functions and is used to evaluate the final result of the assertion chain as well as resolving the final message withe the values of the execution chain.
Keeps track of the current this
context for the assertions, this starts out as
the initial IAssertInst object but is changed during the evaluation of
the operations, which allows operations to be chained together even when the
subsequent operations return different this
objects that do not inherit from
or extend the initial IAssertInst object.
Creates a new operation by adding the functions / properties as defined by the
IAssertScopeFuncDef type to the obj
, when no obj
is passed a new
empty
IAssertInstCore instance is created, decorated and returned.
The returned object is "generally" returned from the IScopeFn
functions and is used to chain the next operation.
The functions / properties to add to the object.
Optional
obj: anyThe optional object to decorate with the defined operations,
if no obj
is provided then an empty
IAssertInstCore will be used.
Executes the given function within the scope this
of the current IAssertScope
passing the provided arguments, the result of the function will be returned.
The result of the function.
Throws an AssertionFailure exception with the given message and optional
details which are obtained via the getDetails
function.
The message to display.
Optional
details: anyThe details (props) to include in the error
AssertionFailure always
Generic failure that throws an AssertionFailure exception with the given
message and optional details which are obtained via the getDetails
function.
The actual value that was expected
The expected value that was not found
Optional
failMsg: MsgSourceThe message to display.
Optional
operator: stringThe optional operator used in the comparison
AssertionFailure always
Throws an AssertionError exception with the given message and optional
details which are obtained via the getDetails
function.
The message to display.
Optional
details: anyThe details (props) to include in the error
AssertionFailure always
Creates a new empty IAssertInstCore assert instance that can be extended or decorated with instance functions for usage via operations. The default implementation returns an object that does not inherit or have access to the IAssertInst functions.
Creates a new "standard" assert instance with the given value and optional override functions, if no arguments are provided then the current scope context value is used, however, if undefined or null is provided then the value is set to the provided value.
Optional
value: VThe new value of the context, this is the actual
value of the assertion.
Optional
overrides: IScopeContextOverridesThe optional overrides for the context
Creates a new Scope instance, it will also create child instances of the current context so that any changes applied on this new scope will not alter the current scope.
Optional
value: VThe new value of the context, this is the actual
value of the assertion.
The new scope instance.
Updates the current context with the given value and optional overrides, this is used to update the current context with the new value and overrides. It avoids the need to create a new IAssertScope or IAssertInst instance for each operation and allows the scope to be updated in place, so all existing scope functions of the current instance can be chained together.
The value to update the context with.
Optional
overrides: IScopeContextOverridesThe optional overrides for the context
The current IAssertScope instance.
The IAssertScope interface provides the main entry point for the assertion chain execution, it provides the main functions for creating new IAssertInst instances and IAssertScope instances as well as the main functions for executing the assertion chain and evaluating the final result.
The IAssertScope is used to create new IAssertInst instances with the given value and optional overrides, it also provides the main functions for executing the assertion chain and evaluating the final result.
Since
0.1.0