mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-21 21:31:12 +08:00
Add optional message param to sinon.match overload that takes a callback
This commit is contained in:
2
types/sinon/index.d.ts
vendored
2
types/sinon/index.d.ts
vendored
@@ -421,7 +421,7 @@ declare namespace Sinon {
|
||||
(value: string): SinonMatcher;
|
||||
(expr: RegExp): SinonMatcher;
|
||||
(obj: any): SinonMatcher;
|
||||
(callback: (value: any) => boolean): SinonMatcher;
|
||||
(callback: (value: any) => boolean, message?: string): SinonMatcher;
|
||||
any: SinonMatcher;
|
||||
defined: SinonMatcher;
|
||||
truthy: SinonMatcher;
|
||||
|
||||
@@ -119,6 +119,14 @@ function testPromises() {
|
||||
rejectsStub2 = sinon.stub().rejects("TypeError");
|
||||
}
|
||||
|
||||
function testMatchInvoke() {
|
||||
let stub = sinon.stub();
|
||||
stub(123);
|
||||
stub.calledWithMatch(sinon.match(123));
|
||||
stub.calledWithMatch(sinon.match((value: any) => value === 123));
|
||||
stub.calledWithMatch(sinon.match((value: any) => value === 123, "Must be 123"));
|
||||
}
|
||||
|
||||
function testSymbolMatch() {
|
||||
let stub = sinon.stub();
|
||||
stub(Symbol('TestSymbol'));
|
||||
|
||||
Reference in New Issue
Block a user