forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
should.d.ts
126 lines (116 loc) · 4.95 KB
/
should.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
// Type definitions for should.js 3.1.2
// Project: https://github.com/visionmedia/should.js
// Definitions by: Alex Varju <https://github.com/varju/>, Maxime LUCE <https://github.com/SomaticIT/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
interface Object {
should: ShouldAssertion;
}
interface ShouldAssertion {
// basic grammar
a: ShouldAssertion;
an: ShouldAssertion;
and: ShouldAssertion;
be: ShouldAssertion;
have: ShouldAssertion;
with: ShouldAssertion;
of: ShouldAssertion;
not: ShouldAssertion;
// validators
arguments: ShouldAssertion;
empty: ShouldAssertion;
ok: ShouldAssertion;
true: ShouldAssertion;
false: ShouldAssertion;
NaN: ShouldAssertion;
Infinity: ShouldAssertion;
Array: ShouldAssertion;
Object: ShouldAssertion;
String: ShouldAssertion;
Boolean: ShouldAssertion;
Number: ShouldAssertion;
Error: ShouldAssertion;
Function: ShouldAssertion;
eql(expected: any, description?: string): ShouldAssertion;
equal(expected: any, description?: string): ShouldAssertion;
within(start: number, finish: number, description?: string): ShouldAssertion;
approximately(value: number, delta: number, description?: string): ShouldAssertion;
type(expected: any, description?: string): ShouldAssertion;
instanceof(constructor: Function, description?: string): ShouldAssertion;
above(n: number, description?: string): ShouldAssertion;
below(n: number, description?: string): ShouldAssertion;
match(other: {}, description?: string): ShouldAssertion;
match(other: (val: any) => any, description?: string): ShouldAssertion;
match(regexp: RegExp, description?: string): ShouldAssertion;
match(other: any, description?: string): ShouldAssertion;
matchEach(other: {}, description?: string): ShouldAssertion;
matchEach(other: (val: any) => any, description?: string): ShouldAssertion;
matchEach(regexp: RegExp, description?: string): ShouldAssertion;
matchEach(other: any, description?: string): ShouldAssertion;
matchAny(other: {}, description?: string): ShouldAssertion;
matchAny(other: (val: any) => any, description?: string): ShouldAssertion;
matchAny(regexp: RegExp, description?: string): ShouldAssertion;
matchAny(other: any, description?: string): ShouldAssertion;
length(n: number, description?: string): ShouldAssertion;
property(name: string, description?: string): ShouldAssertion;
property(name: string, val: any, description?: string): ShouldAssertion;
properties(names: string[]): ShouldAssertion;
properties(name: string): ShouldAssertion;
properties(descriptor: any): ShouldAssertion;
properties(...properties: string[]): ShouldAssertion;
ownProperty(name: string, description?: string): ShouldAssertion;
contain(obj: any): ShouldAssertion;
containEql(obj: any): ShouldAssertion;
containDeep(obj: any): ShouldAssertion;
keys(...allKeys: string[]): ShouldAssertion;
keys(allKeys: string[]): ShouldAssertion;
header(field: string, val?: string): ShouldAssertion;
status(code: number): ShouldAssertion;
json: ShouldAssertion;
html: ShouldAssertion;
startWith(expected: string, message?: any): ShouldAssertion;
endWith(expected: string, message?: any): ShouldAssertion;
throw(message?: any): ShouldAssertion;
// deprecated
include(obj: any, description?: string): ShouldAssertion;
includeEql(obj: any[], description?: string): ShouldAssertion;
// aliases
exactly(expected: any, description?: string): ShouldAssertion;
instanceOf(constructor: Function, description?: string): ShouldAssertion;
throwError(message?: any): ShouldAssertion;
lengthOf(n: number, description?: string): ShouldAssertion;
key(key: string): ShouldAssertion;
haveOwnProperty(name: string, description?: string): ShouldAssertion;
greaterThan(n: number, description?: string): ShouldAssertion;
lessThan(n: number, description?: string): ShouldAssertion;
}
interface ShouldInternal {
// should.js's extras
exist(actual: any, msg?: string): void;
exists(actual: any, msg?: string): void;
not: ShouldInternal;
}
interface Internal extends ShouldInternal {
(obj: any): ShouldAssertion;
// node.js's assert functions
fail(actual: any, expected: any, message: string, operator: string): void;
assert(value: any, message: string): void;
ok(value: any, message?: string): void;
equal(actual: any, expected: any, message?: string): void;
notEqual(actual: any, expected: any, message?: string): void;
deepEqual(actual: any, expected: any, message?: string): void;
notDeepEqual(actual: any, expected: any, message?: string): void;
strictEqual(actual: any, expected: any, message?: string): void;
notStrictEqual(actual: any, expected: any, message?: string): void;
throws(block: any, error?: any, message?: string): void;
doesNotThrow(block: any, message?: string): void;
ifError(value: any): void;
inspect(value: any, obj: any): any;
}
declare var should: Internal;
declare var Should: Internal;
interface Window {
Should: Internal;
}
declare module "should" {
export = should;
}