forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexpect.d.ts
71 lines (64 loc) · 2.81 KB
/
expect.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// Type definitions for Expect v1.13.4
// Project: https://github.com/mjackson/expect
// Definitions by: Justin Reidy <https://github.com/jmreidy/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module "expect" {
export class Expectation {
constructor(actual:any);
toExist(message?:string):Expectation;
toBeTruthy(message?:string):Expectation;
toNotExist(message?:string):Expectation;
toBeFalsy(message?:string):Expectation;
toBe(value:any, message?:string):Expectation;
toNotBe(value:any, message?:string):Expectation;
toEqual(value:any, message?:string):Expectation;
toNotEqual(value:any, message?:string):Expectation;
toThrow(value?:any, message?:string):Expectation;
toNotThrow(value?:any, message?:string):Expectation;
toBeA(value:any, message?:string):Expectation;
toBeAn(value:any, message?:string):Expectation;
toNotBeA(value:any, message?:string):Expectation;
toNotBeAn(value:any, message?:string):Expectation;
toMatch(value:any, message?:string):Expectation;
toNotMatch(value:any, message?:string):Expectation;
toBeLessThan(value:any, message?:string):Expectation;
toBeFewerThan(value:any, message?:string):Expectation;
toBeGreaterThan(value:any, message?:string):Expectation;
toBeMoreThan(value:any, message?:string):Expectation;
toInclude(value:any, compareValues?:any, message?:string):Expectation;
toContain(value:any, compareValues?:any, message?:string):Expectation;
toExclude(value:any, compareValues?:any, message?:string):Expectation;
toNotContain(value:any, compareValues?:any, message?:string):Expectation;
toHaveBeenCalled(message?:string):Expectation;
toHaveBeenCalledWith(...args:Array<any>):Expectation;
toNotHaveBeenCalled(message?:string):Expectation;
withContext(context:any):Expectation;
withArgs(...args:Array<any>):Expectation;
}
export interface Extension {
[name:string]:(args?:Array<any>) => void;
}
export interface Call {
context: Spy;
arguments: Array<any>;
}
export interface Spy {
__isSpy:Boolean;
calls:Array<Call>;
andCall(fn:Function):Spy;
andCallThrough():Spy;
andThrow(object:Object):Spy;
andReturn(value:any):Spy;
getLastCall():Call;
restore():void;
destroy():void;
}
function expect(actual:any):Expectation;
export function createSpy(fn?:Function, restore?:Function):Spy;
export function spyOn(object:Object, methodName:string):Spy;
export function isSpy(object:any):Boolean;
export function restoreSpies():void;
export function assert(condition:any, messageFormat:string, ...extraArgs:Array<any>):void;
export function extend(extension:Extension):void;
export default expect;
}