1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | declare module 'chai-as-promised' {
|
7 | function chaiAsPromised(chai: any, utils: any): void;
|
8 | namespace chaiAsPromised {}
|
9 | export = chaiAsPromised;
|
10 | }
|
11 |
|
12 |
|
13 | declare namespace Chai {
|
14 |
|
15 | interface Assertion extends LanguageChains, NumericComparison, TypeComparison {
|
16 | eventually: PromisedAssertion;
|
17 | fulfilled: PromisedAssertion;
|
18 | become(expected: any): PromisedAssertion;
|
19 | rejected(): PromisedAssertion;
|
20 | rejectedWith(expected: any, message?: string | RegExp): PromisedAssertion;
|
21 | notify(fn: Function): PromisedAssertion;
|
22 | }
|
23 |
|
24 |
|
25 | interface Eventually extends PromisedLanguageChains, PromisedNumericComparison, PromisedTypeComparison {
|
26 |
|
27 | become(expected: PromiseLike<any>): PromisedAssertion;
|
28 | fulfilled: PromisedAssertion;
|
29 | rejected: () => PromisedAssertion;
|
30 | rejectedWith(expected: any, message?: string | RegExp): PromisedAssertion;
|
31 | notify(fn: Function): PromisedAssertion;
|
32 |
|
33 |
|
34 | not: PromisedAssertion;
|
35 | deep: PromisedDeep;
|
36 | all: PromisedKeyFilter;
|
37 | a: PromisedTypeComparison;
|
38 | an: PromisedTypeComparison;
|
39 | include: PromisedInclude;
|
40 | contain: PromisedInclude;
|
41 | ok: PromisedAssertion;
|
42 | true: () => PromisedAssertion;
|
43 | false: () => PromisedAssertion;
|
44 | null: PromisedAssertion;
|
45 | undefined: PromisedAssertion;
|
46 | exist: PromisedAssertion;
|
47 | empty: PromisedAssertion;
|
48 | arguments: PromisedAssertion;
|
49 | Arguments: PromisedAssertion;
|
50 | equal: PromisedEqual;
|
51 | equals: PromisedEqual;
|
52 | eq: PromisedEqual;
|
53 | eql: PromisedEqual;
|
54 | eqls: PromisedEqual;
|
55 | property: PromisedProperty;
|
56 | ownProperty: PromisedOwnProperty;
|
57 | haveOwnProperty: PromisedOwnProperty;
|
58 | length: PromisedLength;
|
59 | lengthOf: PromisedLength;
|
60 | match(regexp: RegExp | string, message?: string): PromisedAssertion;
|
61 | string(string: string, message?: string): PromisedAssertion;
|
62 | keys: PromisedKeys;
|
63 | key(string: string): PromisedAssertion;
|
64 | throw: PromisedThrow;
|
65 | throws: PromisedThrow;
|
66 | Throw: PromisedThrow;
|
67 | respondTo(method: string, message?: string): PromisedAssertion;
|
68 | itself: PromisedAssertion;
|
69 | satisfy(matcher: Function, message?: string): PromisedAssertion;
|
70 | closeTo(expected: number, delta: number, message?: string): PromisedAssertion;
|
71 | members: PromisedMembers;
|
72 | }
|
73 |
|
74 | interface PromisedAssertion extends Eventually, PromiseLike<any> {}
|
75 |
|
76 | interface PromisedLanguageChains {
|
77 | eventually: Eventually;
|
78 |
|
79 |
|
80 | to: PromisedAssertion;
|
81 | be: PromisedAssertion;
|
82 | been: PromisedAssertion;
|
83 | is: PromisedAssertion;
|
84 | that: PromisedAssertion;
|
85 | which: PromisedAssertion;
|
86 | and: PromisedAssertion;
|
87 | has: PromisedAssertion;
|
88 | have: PromisedAssertion;
|
89 | with: PromisedAssertion;
|
90 | at: PromisedAssertion;
|
91 | of: PromisedAssertion;
|
92 | same: PromisedAssertion;
|
93 | }
|
94 |
|
95 | interface PromisedNumericComparison {
|
96 | above: PromisedNumberComparer;
|
97 | gt: PromisedNumberComparer;
|
98 | greaterThan: PromisedNumberComparer;
|
99 | least: PromisedNumberComparer;
|
100 | gte: PromisedNumberComparer;
|
101 | below: PromisedNumberComparer;
|
102 | lt: PromisedNumberComparer;
|
103 | lessThan: PromisedNumberComparer;
|
104 | most: PromisedNumberComparer;
|
105 | lte: PromisedNumberComparer;
|
106 | within(start: number, finish: number, message?: string): PromisedAssertion;
|
107 | }
|
108 |
|
109 | type PromisedNumberComparer = (value: number, message?: string) => PromisedAssertion;
|
110 |
|
111 | interface PromisedTypeComparison {
|
112 | (type: string, message?: string): PromisedAssertion;
|
113 | instanceof: PromisedInstanceOf;
|
114 | instanceOf: PromisedInstanceOf;
|
115 | }
|
116 |
|
117 | type PromisedInstanceOf = (constructor: Object, message?: string) => PromisedAssertion;
|
118 |
|
119 | interface PromisedDeep {
|
120 | equal: PromisedEqual;
|
121 | include: PromisedInclude;
|
122 | property: PromisedProperty;
|
123 | }
|
124 |
|
125 | interface PromisedKeyFilter {
|
126 | keys: PromisedKeys;
|
127 | }
|
128 |
|
129 | type PromisedEqual = (value: any, message?: string) => PromisedAssertion;
|
130 |
|
131 | type PromisedProperty = (name: string, value?: any, message?: string) => PromisedAssertion;
|
132 |
|
133 | type PromisedOwnProperty = (name: string, message?: string) => PromisedAssertion;
|
134 |
|
135 | interface PromisedLength extends PromisedLanguageChains, PromisedNumericComparison {
|
136 | (length: number, message?: string): PromisedAssertion;
|
137 | }
|
138 |
|
139 | interface PromisedInclude {
|
140 | (value: Object | string | number, message?: string): PromisedAssertion;
|
141 | keys: PromisedKeys;
|
142 | members: PromisedMembers;
|
143 | all: PromisedKeyFilter;
|
144 | }
|
145 |
|
146 | interface PromisedKeys {
|
147 | (...keys: string[]): PromisedAssertion;
|
148 | (keys: any[]): PromisedAssertion;
|
149 | }
|
150 |
|
151 | interface PromisedThrow {
|
152 | (): PromisedAssertion;
|
153 | (expected: string | RegExp, message?: string): PromisedAssertion;
|
154 | (constructor: Error | Function, expected?: string | RegExp, message?: string): PromisedAssertion;
|
155 | }
|
156 |
|
157 | type PromisedMembers = (set: any[], message?: string) => PromisedAssertion;
|
158 |
|
159 | // For Assert API
|
160 | interface Assert {
|
161 | eventually: PromisedAssert;
|
162 | isFulfilled(promise: PromiseLike<any>, message?: string): PromiseLike<void>;
|
163 | becomes(promise: PromiseLike<any>, expected: any, message?: string): PromiseLike<void>;
|
164 | doesNotBecome(promise: PromiseLike<any>, expected: any, message?: string): PromiseLike<void>;
|
165 | isRejected(promise: PromiseLike<any>, message?: string): PromiseLike<void>;
|
166 | isRejected(promise: PromiseLike<any>, expected: any | RegExp, message?: string): PromiseLike<void>;
|
167 | notify(fn: Function): PromiseLike<void>;
|
168 | }
|
169 |
|
170 | export interface PromisedAssert {
|
171 | fail(actual?: any, expected?: any, msg?: string, operator?: string): PromiseLike<void>;
|
172 |
|
173 | ok(val: any, msg?: string): PromiseLike<void>;
|
174 | notOk(val: any, msg?: string): PromiseLike<void>;
|
175 |
|
176 | equal(act: any, exp: any, msg?: string): PromiseLike<void>;
|
177 | notEqual(act: any, exp: any, msg?: string): PromiseLike<void>;
|
178 |
|
179 | strictEqual(act: any, exp: any, msg?: string): PromiseLike<void>;
|
180 | notStrictEqual(act: any, exp: any, msg?: string): PromiseLike<void>;
|
181 |
|
182 | deepEqual(act: any, exp: any, msg?: string): PromiseLike<void>;
|
183 | notDeepEqual(act: any, exp: any, msg?: string): PromiseLike<void>;
|
184 |
|
185 | isTrue(val: any, msg?: string): PromiseLike<void>;
|
186 | isFalse(val: any, msg?: string): PromiseLike<void>;
|
187 |
|
188 | isNull(val: any, msg?: string): PromiseLike<void>;
|
189 | isNotNull(val: any, msg?: string): PromiseLike<void>;
|
190 |
|
191 | isUndefined(val: any, msg?: string): PromiseLike<void>;
|
192 | isDefined(val: any, msg?: string): PromiseLike<void>;
|
193 |
|
194 | isFunction(val: any, msg?: string): PromiseLike<void>;
|
195 | isNotFunction(val: any, msg?: string): PromiseLike<void>;
|
196 |
|
197 | isObject(val: any, msg?: string): PromiseLike<void>;
|
198 | isNotObject(val: any, msg?: string): PromiseLike<void>;
|
199 |
|
200 | isArray(val: any, msg?: string): PromiseLike<void>;
|
201 | isNotArray(val: any, msg?: string): PromiseLike<void>;
|
202 |
|
203 | isString(val: any, msg?: string): PromiseLike<void>;
|
204 | isNotString(val: any, msg?: string): PromiseLike<void>;
|
205 |
|
206 | isNumber(val: any, msg?: string): PromiseLike<void>;
|
207 | isNotNumber(val: any, msg?: string): PromiseLike<void>;
|
208 |
|
209 | isBoolean(val: any, msg?: string): PromiseLike<void>;
|
210 | isNotBoolean(val: any, msg?: string): PromiseLike<void>;
|
211 |
|
212 | typeOf(val: any, type: string, msg?: string): PromiseLike<void>;
|
213 | notTypeOf(val: any, type: string, msg?: string): PromiseLike<void>;
|
214 |
|
215 | instanceOf(val: any, type: Function, msg?: string): PromiseLike<void>;
|
216 | notInstanceOf(val: any, type: Function, msg?: string): PromiseLike<void>;
|
217 |
|
218 | include(exp: string | any[], inc: any, msg?: string): PromiseLike<void>;
|
219 |
|
220 | notInclude(exp: string | any[], inc: any, msg?: string): PromiseLike<void>;
|
221 |
|
222 | match(exp: any, re: RegExp, msg?: string): PromiseLike<void>;
|
223 | notMatch(exp: any, re: RegExp, msg?: string): PromiseLike<void>;
|
224 |
|
225 | property(obj: Object, prop: string, msg?: string): PromiseLike<void>;
|
226 | notProperty(obj: Object, prop: string, msg?: string): PromiseLike<void>;
|
227 | deepProperty(obj: Object, prop: string, msg?: string): PromiseLike<void>;
|
228 | notDeepProperty(obj: Object, prop: string, msg?: string): PromiseLike<void>;
|
229 |
|
230 | propertyVal(obj: Object, prop: string, val: any, msg?: string): PromiseLike<void>;
|
231 | propertyNotVal(obj: Object, prop: string, val: any, msg?: string): PromiseLike<void>;
|
232 |
|
233 | deepPropertyVal(obj: Object, prop: string, val: any, msg?: string): PromiseLike<void>;
|
234 | deepPropertyNotVal(obj: Object, prop: string, val: any, msg?: string): PromiseLike<void>;
|
235 |
|
236 | lengthOf(exp: any, len: number, msg?: string): PromiseLike<void>;
|
237 |
|
238 | throw(fn: Function, msg?: string): PromiseLike<void>;
|
239 | throw(fn: Function, regExp: RegExp): PromiseLike<void>;
|
240 | throw(fn: Function, errType: Function, msg?: string): PromiseLike<void>;
|
241 | throw(fn: Function, errType: Function, regExp: RegExp): PromiseLike<void>;
|
242 |
|
243 | throws(fn: Function, msg?: string): PromiseLike<void>;
|
244 | throws(fn: Function, regExp: RegExp): PromiseLike<void>;
|
245 | throws(fn: Function, errType: Function, msg?: string): PromiseLike<void>;
|
246 | throws(fn: Function, errType: Function, regExp: RegExp): PromiseLike<void>;
|
247 |
|
248 | Throw(fn: Function, msg?: string): PromiseLike<void>;
|
249 | Throw(fn: Function, regExp: RegExp): PromiseLike<void>;
|
250 | Throw(fn: Function, errType: Function, msg?: string): PromiseLike<void>;
|
251 | Throw(fn: Function, errType: Function, regExp: RegExp): PromiseLike<void>;
|
252 |
|
253 | doesNotThrow(fn: Function, msg?: string): PromiseLike<void>;
|
254 | doesNotThrow(fn: Function, regExp: RegExp): PromiseLike<void>;
|
255 | doesNotThrow(fn: Function, errType: Function, msg?: string): PromiseLike<void>;
|
256 | doesNotThrow(fn: Function, errType: Function, regExp: RegExp): PromiseLike<void>;
|
257 |
|
258 | operator(val: any, operator: string, val2: any, msg?: string): PromiseLike<void>;
|
259 | closeTo(act: number, exp: number, delta: number, msg?: string): PromiseLike<void>;
|
260 |
|
261 | sameMembers(set1: any[], set2: any[], msg?: string): PromiseLike<void>;
|
262 | includeMembers(set1: any[], set2: any[], msg?: string): PromiseLike<void>;
|
263 |
|
264 | ifError(val: any, msg?: string): PromiseLike<void>;
|
265 | }
|
266 | }
|