Global

Methods

expects() → {Expectation}

Source:

Create a new expectation of the function or method

Returns:
Type
Expectation

func() → {FakeFunction}

Source:

Create a fake function

Returns:
Type
FakeFunction

obj(object) → {Object}

Source:

Create a fake object. The fake object has cloned properties and cloned methods or fake methods:

  • The methods in except options are copied to the fake object from original object.
  • The methods in only options are fake functions.
  • As default, All methods are fake functions.
Parameters:
Name Type Attributes Description
object Object

a fake object

opts.except Array.<string> <nullable>

method name list. the methods of a object are not fake function, use original method.

opts.only Array.<string> <nullable>

method name list. The methods of a object are fake function instead of original method.

Returns:

a fake object

Type
Object