mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-12 22:36:10 +08:00
Fix sinon-chai to match recent chai updates
This commit is contained in:
4
chai/chai.d.ts
vendored
4
chai/chai.d.ts
vendored
@@ -8,6 +8,10 @@ declare module chai {
|
||||
|
||||
function expect(target: any): Expect;
|
||||
|
||||
interface ExpectStatic {
|
||||
(target: any): Expect;
|
||||
}
|
||||
|
||||
interface Expect extends LanguageChains, NumericComparison, TypeComparison {
|
||||
not: Expect;
|
||||
deep: Deep;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
/// <reference path="../chai/chai.d.ts" />
|
||||
/// <reference path="sinon-chai.d.ts" />
|
||||
|
||||
var expect = chai.expect;
|
||||
declare var expect: chai.ExpectStatic;
|
||||
|
||||
function test() {
|
||||
var spy;
|
||||
var anotherSpy;
|
||||
var spy: Function;
|
||||
var anotherSpy: Function;
|
||||
var context;
|
||||
var match;
|
||||
|
||||
@@ -15,6 +15,8 @@ function test() {
|
||||
expect(spy).to.have.been.calledThrice;
|
||||
expect(spy).to.have.been.calledBefore(anotherSpy);
|
||||
expect(spy).to.have.been.calledAfter(anotherSpy);
|
||||
expect(spy).to.have.been.calledWithNew;
|
||||
expect(spy).to.have.been.alwaysCalledWithNew;
|
||||
expect(spy).to.have.been.calledOn(context);
|
||||
expect(spy).to.have.been.alwaysCalledOn(context);
|
||||
expect(spy).to.have.been.calledWith('foo', 'bar');
|
||||
@@ -23,8 +25,8 @@ function test() {
|
||||
expect(spy).to.have.been.alwaysCalledWithExactly('foo', 'bar');
|
||||
expect(spy).to.have.been.calledWithMatch(match);
|
||||
expect(spy).to.have.been.alwaysCalledWithMatch(match);
|
||||
expect(spy).to.have.been.returned(1);
|
||||
expect(spy).to.have.been.alwaysReturned(1);
|
||||
expect(spy).to.have.been.threw('an error');
|
||||
expect(spy).to.have.been.alwaysThrew('an error');
|
||||
}
|
||||
expect(spy).to.have.returned(1);
|
||||
expect(spy).to.have.alwaysReturned(1);
|
||||
expect(spy).threw('an error');
|
||||
expect(spy).alwaysThrew('an error');
|
||||
}
|
||||
|
||||
44
sinon-chai/sinon-chai.d.ts
vendored
44
sinon-chai/sinon-chai.d.ts
vendored
@@ -6,28 +6,26 @@
|
||||
/// <reference path="../chai/chai.d.ts" />
|
||||
|
||||
declare module chai {
|
||||
interface Been {
|
||||
called: boolean;
|
||||
calledOnce: boolean;
|
||||
calledTwice: boolean;
|
||||
calledThrice: boolean;
|
||||
calledBefore(spy: any): boolean;
|
||||
calledAfter(spy: any): boolean;
|
||||
calledOn(context: any): boolean;
|
||||
alwaysCalledOn(context: any): boolean;
|
||||
calledWith(...args: any[]): boolean;
|
||||
alwaysCalledWith(...args: any[]): boolean;
|
||||
calledWithExactly(...args: any[]): boolean;
|
||||
alwaysCalledWithExactly(...args: any[]): boolean;
|
||||
calledWithMatch(...args: any[]): boolean;
|
||||
alwaysCalledWithMatch(...args: any[]): boolean;
|
||||
returned(returnVal: any): boolean;
|
||||
alwaysReturned(returnVal: any): boolean;
|
||||
threw(errorObjOrErrorTypeStringOrNothing: any): boolean;
|
||||
alwaysThrew(errorObjOrErrorTypeStringOrNothing: any): boolean;
|
||||
}
|
||||
|
||||
interface Have {
|
||||
been: Been;
|
||||
interface Expect {
|
||||
called: Expect;
|
||||
calledOnce: Expect;
|
||||
calledTwice: Expect;
|
||||
calledThrice: Expect;
|
||||
calledBefore(spy: Function): Expect;
|
||||
calledAfter(spy: Function): Expect;
|
||||
calledWithNew: Expect;
|
||||
alwaysCalledWithNew: Expect;
|
||||
calledOn(context: any): Expect;
|
||||
alwaysCalledOn(context: any): Expect;
|
||||
calledWith(...args: any[]): Expect;
|
||||
alwaysCalledWith(...args: any[]): Expect;
|
||||
calledWithExactly(...args: any[]): Expect;
|
||||
alwaysCalledWithExactly(...args: any[]): Expect;
|
||||
calledWithMatch(...args: any[]): Expect;
|
||||
alwaysCalledWithMatch(...args: any[]): Expect;
|
||||
returned(returnVal: any): Expect;
|
||||
alwaysReturned(returnVal: any): Expect;
|
||||
threw(errorObjOrErrorTypeStringOrNothing: any): Expect;
|
||||
alwaysThrew(errorObjOrErrorTypeStringOrNothing: any): Expect;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user