mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-15 09:37:52 +08:00
Add spy.named() and stub.named() (#29469)
This commit is contained in:
10
types/sinon/index.d.ts
vendored
10
types/sinon/index.d.ts
vendored
@@ -295,6 +295,11 @@ declare namespace Sinon {
|
||||
* Returns an Array with all callbacks return values in the order they were called, if no error is thrown.
|
||||
*/
|
||||
invokeCallback(...args: any[]): void;
|
||||
/**
|
||||
* Set the displayName of the spy or stub.
|
||||
* @param name
|
||||
*/
|
||||
named(name: string): SinonSpy;
|
||||
/**
|
||||
* Returns the nth call.
|
||||
* Accessing individual calls helps with more detailed behavior verification when the spy is called more than once.
|
||||
@@ -530,6 +535,11 @@ declare namespace Sinon {
|
||||
* @param val
|
||||
*/
|
||||
value(val: any): SinonStub;
|
||||
/**
|
||||
* Set the displayName of the spy or stub.
|
||||
* @param name
|
||||
*/
|
||||
named(name: string): SinonStub;
|
||||
/**
|
||||
* Similar to callsArg.
|
||||
* Causes the stub to call the first callback it receives with the provided arguments (if any).
|
||||
|
||||
@@ -296,7 +296,7 @@ function testSpy() {
|
||||
const instance = new obj();
|
||||
|
||||
let spy = sinon.spy();
|
||||
const spyTwo = sinon.spy();
|
||||
const spyTwo = sinon.spy().named('spyTwo');
|
||||
|
||||
spy = sinon.spy(fn);
|
||||
spy = sinon.spy(instance, 'foo');
|
||||
@@ -386,7 +386,7 @@ function testStub() {
|
||||
const instance = new obj();
|
||||
|
||||
let stub = sinon.stub();
|
||||
stub = sinon.stub(instance, 'foo');
|
||||
stub = sinon.stub(instance, 'foo').named('namedStub');
|
||||
|
||||
const spy: sinon.SinonSpy = stub;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user