and

Namespace: and

Spy#and

Methods

callFake(fn)

Tell the spy to call a fake implementation when invoked.

Parameters:
Name Type Description
fn function

The function to invoke with the passed parameters.

callThrough()

Tell the spy to call through to the real implementation when invoked.

exec()

Execute the current spy strategy.

identity() → {String}

Return the identifying information for the spy.

Returns:
Type
String

returnValue(value)

Tell the spy to return the value when invoked.

Parameters:
Name Type Description
value *

The value to return.

returnValues(…values)

Tell the spy to return one of the specified values (sequentially) each time the spy is invoked.

Parameters:
Name Type Attributes Description
values * <repeatable>

Values to be returned on subsequent calls to the spy.

stub()

Tell the spy to do nothing when invoked. This is the default.

throwError(something)

Tell the spy to throw an error when invoked.

Parameters:
Name Type Description
something Error | String

Thing to throw

© 2008–2017 Pivotal Labs
Licensed under the MIT License.
https://jasmine.github.io/api/2.6/Spy_and.html

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部