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 | interface ShouldAssertion {
|
31 |
|
32 | a: ShouldAssertion;
|
33 | an: ShouldAssertion;
|
34 | and: ShouldAssertion;
|
35 | be: ShouldAssertion;
|
36 | has: ShouldAssertion;
|
37 | have: ShouldAssertion;
|
38 | is: ShouldAssertion;
|
39 | it: ShouldAssertion;
|
40 | with: ShouldAssertion;
|
41 | which: ShouldAssertion;
|
42 | the: ShouldAssertion;
|
43 | of: ShouldAssertion;
|
44 | not: ShouldAssertion;
|
45 |
|
46 |
|
47 | to: ShouldAssertion;
|
48 |
|
49 |
|
50 | arguments(): ShouldAssertion;
|
51 | empty(): ShouldAssertion;
|
52 | ok(): ShouldAssertion;
|
53 | true(): ShouldAssertion;
|
54 | false(): ShouldAssertion;
|
55 | NaN(): ShouldAssertion;
|
56 | Infinity(): ShouldAssertion;
|
57 | Array(): ShouldAssertion;
|
58 | Object(): ShouldAssertion;
|
59 | String(): ShouldAssertion;
|
60 | Boolean(): ShouldAssertion;
|
61 | Number(): ShouldAssertion;
|
62 | Error(): ShouldAssertion;
|
63 | Function(): ShouldAssertion;
|
64 | Date(): ShouldAssertion;
|
65 | Class(): ShouldAssertion;
|
66 | Undefined(): ShouldAssertion;
|
67 | Null(): ShouldAssertion;
|
68 | Promise(): ShouldAssertion;
|
69 | generator(): ShouldAssertion;
|
70 | iterable(): ShouldAssertion;
|
71 | iterator(): ShouldAssertion;
|
72 | eql(expected: any, description?: string): ShouldAssertion;
|
73 | equal(expected: any, description?: string): ShouldAssertion;
|
74 | equalOneOf(...values: any[]): ShouldAssertion;
|
75 | within(start: number, finish: number, description?: string): ShouldAssertion;
|
76 | approximately(
|
77 | value: number,
|
78 | delta: number,
|
79 | description?: string,
|
80 | ): ShouldAssertion;
|
81 | type(expected: any, description?: string): ShouldAssertion;
|
82 | instanceof(constructor: Function, description?: string): ShouldAssertion;
|
83 | above(n: number, description?: string): ShouldAssertion;
|
84 | below(n: number, description?: string): ShouldAssertion;
|
85 | aboveOrEqual(n: number, description?: string): ShouldAssertion;
|
86 | greaterThanOrEqual(n: number, description?: string): ShouldAssertion;
|
87 | belowOrEqual(n: number, description?: string): ShouldAssertion;
|
88 | lessThanOrEqual(n: number, description?: string): ShouldAssertion;
|
89 | match(other: {}, description?: string): ShouldAssertion;
|
90 | match(other: (val: any) => any, description?: string): ShouldAssertion;
|
91 | match(regexp: RegExp, description?: string): ShouldAssertion;
|
92 | match(other: any, description?: string): ShouldAssertion;
|
93 | matchEach(other: {}, description?: string): ShouldAssertion;
|
94 | matchEach(other: (val: any) => any, description?: string): ShouldAssertion;
|
95 | matchEach(regexp: RegExp, description?: string): ShouldAssertion;
|
96 | matchEach(other: any, description?: string): ShouldAssertion;
|
97 | matchAny(other: {}, description?: string): ShouldAssertion;
|
98 | matchAny(other: (val: any) => any, description?: string): ShouldAssertion;
|
99 | matchAny(regexp: RegExp, description?: string): ShouldAssertion;
|
100 | matchAny(other: any, description?: string): ShouldAssertion;
|
101 | length(n: number, description?: string): ShouldAssertion;
|
102 | property(name: string, description?: string): ShouldAssertion;
|
103 | property(name: string, val: any, description?: string): ShouldAssertion;
|
104 | properties(names: string[]): ShouldAssertion;
|
105 | properties(name: string): ShouldAssertion;
|
106 | properties(descriptor: any): ShouldAssertion;
|
107 | properties(...properties: string[]): ShouldAssertion;
|
108 | propertyByPath(...properties: string[]): ShouldAssertion;
|
109 | propertyWithDescriptor(
|
110 | name: string,
|
111 | descriptor: PropertyDescriptor,
|
112 | ): ShouldAssertion;
|
113 | oneOf(...values: any[]): ShouldAssertion;
|
114 | ownProperty(name: string, description?: string): ShouldAssertion;
|
115 | containEql(obj: any): ShouldAssertion;
|
116 | containDeep(obj: any): ShouldAssertion;
|
117 | containDeepOrdered(obj: any): ShouldAssertion;
|
118 | keys(...allKeys: string[]): ShouldAssertion;
|
119 | keys(allKeys: string[]): ShouldAssertion;
|
120 | enumerable(property: string, value?: any): ShouldAssertion;
|
121 | enumerables(...properties: string[]): ShouldAssertion;
|
122 | startWith(expected: string, message?: any): ShouldAssertion;
|
123 | endWith(expected: string, message?: any): ShouldAssertion;
|
124 | throw(propereties?: {}): ShouldAssertion;
|
125 | throw(message: Function | string | RegExp, properties?: {}): ShouldAssertion;
|
126 |
|
127 | //promises
|
128 | eventually: ShouldAssertion;
|
129 | finally: ShouldAssertion;
|
130 | fulfilled(): Promise<any>;
|
131 | fulfilledWith(value: any): Promise<any>;
|
132 | rejected(): Promise<any>;
|
133 | rejectedWith(err: Function | string | RegExp, properties?: {}): Promise<any>;
|
134 | rejectedWith(properties: {}): Promise<any>;
|
135 |
|
136 | //http
|
137 | header(field: string, val?: string): ShouldAssertion;
|
138 | status(code: number): ShouldAssertion;
|
139 | json(): ShouldAssertion;
|
140 | html(): ShouldAssertion;
|
141 |
|
142 | //stubs
|
143 | alwaysCalledOn(thisTarget: any): ShouldAssertion;
|
144 | alwaysCalledWith(...arguments: any[]): ShouldAssertion;
|
145 | alwaysCalledWithExactly(...arguments: any[]): ShouldAssertion;
|
146 | alwaysCalledWithMatch(...arguments: any[]): ShouldAssertion;
|
147 | alwaysCalledWithNew(): ShouldAssertion;
|
148 | alwaysThrew(exception?: any): ShouldAssertion;
|
149 | callCount(count: number): ShouldAssertion;
|
150 | called(): ShouldAssertion;
|
151 | calledOn(thisTarget: any): ShouldAssertion;
|
152 | calledOnce(): ShouldAssertion;
|
153 | calledTwice(): ShouldAssertion;
|
154 | calledThrice(): ShouldAssertion;
|
155 | calledWith(...arguments: any[]): ShouldAssertion;
|
156 | calledWithExactly(...arguments: any[]): ShouldAssertion;
|
157 | calledWithMatch(...arguments: any[]): ShouldAssertion;
|
158 | calledWithNew(): ShouldAssertion;
|
159 | neverCalledWith(...arguments: any[]): ShouldAssertion;
|
160 | neverCalledWithMatch(...arguments: any[]): ShouldAssertion;
|
161 | threw(exception?: any): ShouldAssertion;
|
162 |
|
163 | // aliases
|
164 | True(): ShouldAssertion;
|
165 | False(): ShouldAssertion;
|
166 | Arguments(): ShouldAssertion;
|
167 | class(): ShouldAssertion;
|
168 | deepEqual(expected: any, description?: string): ShouldAssertion;
|
169 | exactly(expected: any, description?: string): ShouldAssertion;
|
170 | instanceOf(constructor: Function, description?: string): ShouldAssertion;
|
171 | throwError(message?: any): ShouldAssertion;
|
172 | lengthOf(n: number, description?: string): ShouldAssertion;
|
173 | key(key: string): ShouldAssertion;
|
174 | hasOwnProperty(name: string, description?: string): ShouldAssertion;
|
175 | greaterThan(n: number, description?: string): ShouldAssertion;
|
176 | lessThan(n: number, description?: string): ShouldAssertion;
|
177 | null(): ShouldAssertion;
|
178 | undefined(): ShouldAssertion;
|
179 | }
|
180 |
|
181 | interface ShouldInternal {
|
182 |
|
183 | exist(actual: any, msg?: string): void;
|
184 | exists(actual: any, msg?: string): void;
|
185 | not: ShouldInternal;
|
186 | }
|
187 |
|
188 | interface Assertion {
|
189 | add(name: string, func: Function): void;
|
190 | addChain(name: string, onCall?: Function): void;
|
191 | alias(from: string, to: string): void;
|
192 | }
|
193 |
|
194 | interface Internal extends ShouldInternal {
|
195 | (obj: any): ShouldAssertion;
|
196 |
|
197 |
|
198 | use(fn: (should: Internal, Assertion: Assertion) => void): Internal;
|
199 |
|
200 |
|
201 | fail(actual: any, expected: any, message: string, operator: string): void;
|
202 | assert(value: any, message: string): void;
|
203 | ok(value: any, message?: string): void;
|
204 | equal(actual: any, expected: any, message?: string): void;
|
205 | notEqual(actual: any, expected: any, message?: string): void;
|
206 | deepEqual(actual: any, expected: any, message?: string): void;
|
207 | notDeepEqual(actual: any, expected: any, message?: string): void;
|
208 | strictEqual(actual: any, expected: any, message?: string): void;
|
209 | notStrictEqual(actual: any, expected: any, message?: string): void;
|
210 | throws(block: any, error?: any, message?: string): void;
|
211 | doesNotThrow(block: any, message?: string): void;
|
212 | ifError(value: any): void;
|
213 | inspect(value: any, obj: any): any;
|
214 | }
|
215 |
|
216 | declare var should: Internal;
|
217 | interface Window {
|
218 | Should: Internal;
|
219 | }
|
220 |
|
221 | declare module 'should' {
|
222 | export = should;
|
223 | }
|