TrackFn Interface
veve / TrackFn
Class: TrackFn
Defined in: framework/Fn.ts:45
Implements
Constructors
new TrackFn()
new TrackFn(
_implementation
):TrackFn
Defined in: framework/Fn.ts:203
Parameters
_implementation
Function
Returns
Methods
clear()
clear():
TrackFn
Defined in: framework/Fn.ts:182
Clears all recorded calls and arguments but retains custom behavior configurations
Returns
The cleared tracked function with retained behavior configurations
Example
getAllArgs()
Call Signature
getAllArgs(): readonly
any
[][]
Defined in: framework/Fn.ts:55
Retrieves the arguments passed to all function calls
Returns
readonly any
[][]
An array of argument arrays for each call
Example
Call Signature
getAllArgs(): readonly
any
[][]
Defined in: framework/Fn.ts:306
Retrieves the arguments passed to all function calls
Returns
readonly any
[][]
An array of argument arrays for each call
Example
getArgsForCall()
Call Signature
getArgsForCall(
index
):undefined
|any
[]
Defined in: framework/Fn.ts:67
Retrieves the arguments passed to a specific function call by index
Parameters
index
number
The index of the function call
Returns
undefined
| any
[]
The arguments of the specified call, or undefined
if not found
Example
Call Signature
getArgsForCall(
index
):undefined
|any
[]
Defined in: framework/Fn.ts:310
Retrieves the arguments passed to a specific function call by index
Parameters
index
number
The index of the function call
Returns
undefined
| any
[]
The arguments of the specified call, or undefined
if not found
Example
getCall()
getCall(
index
):undefined
|FunctionCall
Defined in: framework/Fn.ts:294
Parameters
index
number
Returns
undefined
| FunctionCall
getCallCount()
getCallCount():
number
Defined in: framework/Fn.ts:302
Returns
number
getCalls()
getCalls(): readonly
FunctionCall
[]
Defined in: framework/Fn.ts:290
Returns
readonly FunctionCall
[]
getExceptions()
Call Signature
getExceptions(): readonly
FunctionException
[]
Defined in: framework/Fn.ts:89
Retrieves the exceptions thrown during function calls
Returns
readonly FunctionException
[]
An array of thrown exceptions
Example
Call Signature
getExceptions(): readonly
FunctionException
[]
Defined in: framework/Fn.ts:318
Retrieves the exceptions thrown during function calls
Returns
readonly FunctionException
[]
An array of thrown exceptions
Example
getLatestCall()
getLatestCall():
undefined
|FunctionCall
Defined in: framework/Fn.ts:298
Returns
undefined
| FunctionCall
getReturnValues()
Call Signature
getReturnValues(): readonly
any
[]
Defined in: framework/Fn.ts:78
Retrieves the return values of all function calls
Returns
readonly any
[]
An array of return values for each call
Example
Call Signature
getReturnValues(): readonly
any
[]
Defined in: framework/Fn.ts:314
Retrieves the return values of all function calls
Returns
readonly any
[]
An array of return values for each call
Example
reset()
Call Signature
reset():
TrackFn
Defined in: framework/Fn.ts:171
Resets the state of the tracked function, clearing all recorded calls, arguments, and results
Returns
The reset tracked function
Example
Call Signature
reset():
TrackFn
Defined in: framework/Fn.ts:261
Resets the state of the tracked function, clearing all recorded calls, arguments, and results
Returns
The reset tracked function
Example
return()
return(
value
):TrackFn
Defined in: framework/Fn.ts:136
Sets the return value for the tracked function
Parameters
value
any
The value to be returned
Returns
The updated tracked function with the configured return value
Example
returns()
returns(
value
):TrackFn
Defined in: framework/Fn.ts:272
Parameters
value
any
Returns
throw()
throw(
error
):TrackFn
Defined in: framework/Fn.ts:148
Configures the tracked function to throw a specific error
Parameters
error
Error
The error to be thrown
Returns
The updated tracked function with the configured error
Example
throws()
throws(
error
):TrackFn
Defined in: framework/Fn.ts:277
Parameters
error
Error
Returns
track()
track():
Function
Defined in: framework/Fn.ts:206
Returns
Function
use()
Call Signature
use(
fn
):TrackFn
Defined in: framework/Fn.ts:160
Replaces the tracked function with a custom implementation
Parameters
fn
(...args
) => any
The custom function to be used
Returns
The updated tracked function with the custom implementation
Example
Call Signature
use(
fn
):TrackFn
Defined in: framework/Fn.ts:284
Replaces the tracked function with a custom implementation
Parameters
fn
Function
The custom function to be used
Returns
The updated tracked function with the custom implementation
Example
wasCalled()
Call Signature
wasCalled():
boolean
Defined in: framework/Fn.ts:100
Checks if the tracked function was called at least once
Returns
boolean
true
if the function was called, otherwise false
Example
Call Signature
wasCalled():
boolean
Defined in: framework/Fn.ts:322
Checks if the tracked function was called at least once
Returns
boolean
true
if the function was called, otherwise false
Example
wasCalledTimes()
Call Signature
wasCalledTimes(
n
):boolean
Defined in: framework/Fn.ts:124
Checks if the tracked function was called a specific number of times
Parameters
n
number
The number of calls to check
Returns
boolean
true
if the function was called exactly n
times, otherwise false
Example
Call Signature
wasCalledTimes(
n
):boolean
Defined in: framework/Fn.ts:334
Checks if the tracked function was called a specific number of times
Parameters
n
number
The number of calls to check
Returns
boolean
true
if the function was called exactly n
times, otherwise false
Example
wasCalledWith()
Call Signature
wasCalledWith(...
args
):boolean
Defined in: framework/Fn.ts:112
Checks if the tracked function was called with specific arguments
Parameters
args
...any
[]
The arguments to check
Returns
boolean
true
if the function was called with the specified arguments, otherwise false
Example
Call Signature
wasCalledWith(...
args
):boolean
Defined in: framework/Fn.ts:326
Checks if the tracked function was called with specific arguments
Parameters
args
...any
[]
The arguments to check
Returns
boolean
true
if the function was called with the specified arguments, otherwise false