Adding calls interface to Jasmine

This commit is contained in:
Antonio Laguna
2014-04-16 14:52:40 +01:00
parent 60de451071
commit 4bb54542fe
+26 -7
View File
@@ -5,13 +5,13 @@
declare function describe(description: string, specDefinitions: () => void): void;
declare function ddescribe(description: string, specDefinitions: () => void): void;
declare function ddescribe(description: string, specDefinitions: () => void): void;
declare function xdescribe(description: string, specDefinitions: () => void): void;
declare function it(expectation: string, assertion?: () => void): void;
declare function it(expectation: string, assertion?: (done: () => void) => void): void;
declare function iit(expectation: string, assertion?: () => void): void;
declare function iit(expectation: string, assertion?: (done: () => void) => void): void;
declare function iit(expectation: string, assertion?: () => void): void;
declare function iit(expectation: string, assertion?: (done: () => void) => void): void;
declare function xit(expectation: string, assertion?: () => void): void;
declare function xit(expectation: string, assertion?: (done: () => void) => void): void;
@@ -98,13 +98,13 @@ declare module jasmine {
addReporter(reporter: Reporter): void;
execute(): void;
describe(description: string, specDefinitions: () => void): Suite;
ddescribe(description: string, specDefinitions: () => void): Suite;
ddescribe(description: string, specDefinitions: () => void): Suite;
beforeEach(beforeEachFunction: () => void): void;
currentRunner(): Runner;
afterEach(afterEachFunction: () => void): void;
xdescribe(desc: string, specDefinitions: () => void): XSuite;
it(description: string, func: () => void): Spec;
iit(description: string, func: () => void): Spec;
iit(description: string, func: () => void): Spec;
xit(desc: string, func: () => void): XSpec;
compareRegExps_(a: RegExp, b: RegExp, mismatchKeys: string[], mismatchValues: string[]): boolean;
compareObjects_(a: any, b: any, mismatchKeys: string[], mismatchValues: string[]): boolean;
@@ -354,7 +354,7 @@ declare module jasmine {
identity: string;
and: SpyAnd;
calls: any;
calls: Calls;
mostRecentCall: { args: any[]; };
argsForCall: any[];
wasCalled: boolean;
@@ -367,13 +367,32 @@ declare module jasmine {
/** By chaining the spy with and.returnValue, all calls to the function will return a specific value. */
returnValue(val: any): void;
/** By chaining the spy with and.callFake, all calls to the spy will delegate to the supplied function. */
callFake(fn: Function): void;
callFake(fn: Function): void;
/** By chaining the spy with and.throwError, all calls to the spy will throw the specified value. */
throwError(msg: string): void;
/** When a calling strategy is used for a spy, the original stubbing behavior can be returned at any time with and.stub. */
stub(): void;
}
interface Calls {
/** By chaining the spy with calls.any(), will return false if the spy has not been called at all, and then true once at least one call happens. **/
any(): boolean;
/** By chaining the spy with calls.count(), will return the number of times the spy was called **/
count(): number;
/** By chaining the spy with calls.argsFor(), will return the arguments passed to call number index **/
argsFor(index: number): any[];
/** By chaining the spy with calls.allArgs(), will return the arguments to all calls **/
allArgs(): any[];
/** By chaining the spy with calls.all(), will return the context (the this) and arguments passed all calls **/
all(): any;
/** By chaining the spy with calls.mostRecent(), will return the context (the this) and arguments for the most recent call **/
mostRecent(): any;
/** By chaining the spy with calls.first(), will return the context (the this) and arguments for the first call **/
first(): any;
/** By chaining the spy with calls.reset(), will clears all tracking for a spy **/
reset(): void;
}
interface Util {
inherit(childClass: Function, parentClass: Function): any;
formatException(e: any): any;