Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface SpyAnd

Hierarchy

  • SpyAnd

Index

Methods

callFake

  • callFake(fn: (...args: any[]) => any): Spy
  • By chaining the spy with and.callFake, all calls to the spy will delegate to the supplied function.

    Parameters

    • fn: (...args: any[]) => any
        • (...args: any[]): any
        • Parameters

          • Rest ...args: any[]

          Returns any

    Returns Spy

callThrough

  • callThrough(): Spy
  • By chaining the spy with and.callThrough, the spy will still track all calls to it but in addition it will delegate to the actual implementation.

    Returns Spy

returnValue

  • returnValue(val: any): Spy
  • By chaining the spy with and.returnValue, all calls to the function will return a specific value.

    Parameters

    • val: any

    Returns Spy

returnValues

  • returnValues(...values: any[]): Spy
  • By chaining the spy with and.returnValues, all calls to the function will return specific values in order until it reaches the end of the return values list.

    Parameters

    • Rest ...values: any[]

    Returns Spy

stub

  • When a calling strategy is used for a spy, the original stubbing behavior can be returned at any time with and.stub.

    Returns Spy

throwError

  • throwError(msg: string): Spy
  • By chaining the spy with and.throwError, all calls to the spy will throw the specified value.

    Parameters

    • msg: string

    Returns Spy