The instance to add the functions to.
An object where the keys are the names of the functions to add, and the values are their definitions.
Optional
responseHandler: (result: any) => anyAssertionError - If any of the definitions are invalid.
addAssertFuncs({
isPositive: (value) => this._context.eval(value > 0)
isNegative: (value) => this._context.eval(value < 0),
isArray: "is.array",
isObject: ["is", "object"]
});
assert.isPositive(1); // Passes
assert.isPositive(0); // Fails - throws an AssertionFailure
assert.isNegative(-1); // Passes
assert.isArray([]); // Passes
assert.isObject({}); // Passes
Adds multiple new assertion functions to the assert instance, it does not add these functions to the IAssertInst "class" so they will be only available by directly referencing the
assert
instance.This method allows you to add multiple assertion functions at once. Each function is defined by a name and a definition. The definition can be a string, an array of strings, a function, or an object that implements the
IAssertDef
interface.