mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 14:57:10 +00:00
Merge pull request #23490 from Flarna/sinon_assert_spycalls
[sinon] allow SinonSpyCall for some asserts
This commit is contained in:
Vendored
+8
-7
@@ -353,19 +353,20 @@ declare namespace Sinon {
|
||||
calledThrice(spy: SinonSpy): void;
|
||||
callCount(spy: SinonSpy, count: number): void;
|
||||
callOrder(...spies: SinonSpy[]): void;
|
||||
calledOn(spy: SinonSpy, obj: any): void;
|
||||
calledOn(spyOrSpyCall: SinonSpy | SinonSpyCall, obj: any): void;
|
||||
alwaysCalledOn(spy: SinonSpy, obj: any): void;
|
||||
calledWith(spy: SinonSpy, ...args: any[]): void;
|
||||
calledWith(spyOrSpyCall: SinonSpy | SinonSpyCall, ...args: any[]): void;
|
||||
alwaysCalledWith(spy: SinonSpy, ...args: any[]): void;
|
||||
neverCalledWith(spy: SinonSpy, ...args: any[]): void;
|
||||
calledWithExactly(spy: SinonSpy, ...args: any[]): void;
|
||||
calledWithExactly(spyOrSpyCall: SinonSpy | SinonSpyCall, ...args: any[]): void;
|
||||
alwaysCalledWithExactly(spy: SinonSpy, ...args: any[]): void;
|
||||
calledWithMatch(spy: SinonSpy, ...args: any[]): void;
|
||||
calledWithMatch(spyOrSpyCall: SinonSpy | SinonSpyCall, ...args: any[]): void;
|
||||
alwaysCalledWithMatch(spy: SinonSpy, ...args: any[]): void;
|
||||
neverCalledWithMatch(spy: SinonSpy, ...args: any[]): void;
|
||||
threw(spy: SinonSpy): void;
|
||||
threw(spy: SinonSpy, exception: string): void;
|
||||
threw(spy: SinonSpy, exception: any): void;
|
||||
calledWithNew(spyOrSpyCall: SinonSpy | SinonSpyCall): void;
|
||||
threw(spyOrSpyCall: SinonSpy | SinonSpyCall): void;
|
||||
threw(spyOrSpyCall: SinonSpy | SinonSpyCall, exception: string): void;
|
||||
threw(spyOrSpyCall: SinonSpy | SinonSpyCall, exception: any): void;
|
||||
alwaysThrew(spy: SinonSpy): void;
|
||||
alwaysThrew(spy: SinonSpy, exception: string): void;
|
||||
alwaysThrew(spy: SinonSpy, exception: any): void;
|
||||
|
||||
@@ -88,6 +88,21 @@ function testNine() {
|
||||
sinon.assert.calledWithMatch(callback, { x: 5 });
|
||||
sinon.assert.alwaysCalledWithMatch(callback, { y: 5 });
|
||||
sinon.assert.neverCalledWithMatch(callback, { x: 6 });
|
||||
|
||||
callback.call("this", "that");
|
||||
callback.throws("Error");
|
||||
try {
|
||||
callback(15);
|
||||
} catch (e) { }
|
||||
sinon.assert.calledWith(callback.firstCall, { x: 5, y: 5});
|
||||
sinon.assert.calledWithExactly(callback.firstCall, { x: 5, y: 5 });
|
||||
sinon.assert.calledWithMatch(callback.firstCall, { x: 5 });
|
||||
sinon.assert.calledOn(callback.secondCall, "this");
|
||||
sinon.assert.threw(callback.thirdCall);
|
||||
sinon.assert.threw(callback.thirdCall, "Error");
|
||||
new (callback as any)();
|
||||
sinon.assert.calledWithNew(callback);
|
||||
sinon.assert.calledWithNew(callback.getCall(4));
|
||||
}
|
||||
|
||||
function testAssert() {
|
||||
|
||||
Reference in New Issue
Block a user