1 |
|
2 |
|
3 | declare function should(obj: any): should.Assertion;
|
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 | declare namespace should {
|
36 | interface ShouldAssertExt {
|
37 | exist(obj: any, msg?: string): void;
|
38 | exists(obj: any, msg?: string): void;
|
39 | }
|
40 |
|
41 | function fail(actual: any, expected: any, message?: string, operator?: string): void;
|
42 | function ok(value: any, message?: string): void;
|
43 | function equal(actual: any, expected: any, message?: string): void;
|
44 | function notEqual(actual: any, expected: any, message?: string): void;
|
45 | function deepEqual(actual: any, expected: any, message?: string): void;
|
46 | function notDeepEqual(actual: any, expected: any, message?: string): void;
|
47 | function strictEqual(actual: any, expected: any, message?: string): void;
|
48 | function notStrictEqual(actual: any, expected: any, message?: string): void;
|
49 |
|
50 | function throws(block: Function, message?: string): void;
|
51 | function throws(block: Function, error: Function, message?: string): void;
|
52 | function throws(block: Function, error: RegExp, message?: string): void;
|
53 | function throws(block: Function, error: (err: any) => boolean, message?: string): void;
|
54 |
|
55 | function doesNotThrow(block: Function, message?: string): void;
|
56 | function doesNotThrow(block: Function, error: Function, message?: string): void;
|
57 | function doesNotThrow(block: Function, error: RegExp, message?: string): void;
|
58 | function doesNotThrow(block: Function, error: (err: any) => boolean, message?: string): void;
|
59 |
|
60 | function ifError(value: any): void;
|
61 |
|
62 | function exist(obj: any, msg?: string): void;
|
63 | function exists(obj: any, msg?: string): void;
|
64 |
|
65 | const not: ShouldAssertExt;
|
66 |
|
67 | interface Assertion {
|
68 | assert(expr: boolean): this;
|
69 | fail(): this;
|
70 |
|
71 | not: this;
|
72 | any: this;
|
73 | only: this;
|
74 |
|
75 |
|
76 | true(message?: string): this;
|
77 | True(message?: string): this;
|
78 |
|
79 | false(message?: string): this;
|
80 | False(message?: string): this;
|
81 |
|
82 | ok(): this;
|
83 |
|
84 |
|
85 | an: this;
|
86 | of: this;
|
87 | a: this;
|
88 | and: this;
|
89 | be: this;
|
90 | been: this;
|
91 | has: this;
|
92 | have: this;
|
93 | with: this;
|
94 | is: this;
|
95 | which: this;
|
96 | the: this;
|
97 | it: this;
|
98 |
|
99 |
|
100 | containEql(obj: any): this;
|
101 | containDeepOrdered(obj: any): this;
|
102 | containDeep(obj: any): this;
|
103 |
|
104 |
|
105 | eql(obj: any, description?: string): this;
|
106 | eqls(obj: any, description?: string): this;
|
107 | deepEqual(obj: any, description?: string): this;
|
108 |
|
109 | equal(obj: any, description?: string): this;
|
110 | equals(obj: any, description?: string): this;
|
111 | exactly(obj: any, description?: string): this;
|
112 |
|
113 | equalOneOf(...objs: any[]): this;
|
114 | equalOneOf(obj: any[]): this;
|
115 | oneOf(...objs: any[]): this;
|
116 | oneOf(obj: any[]): this;
|
117 |
|
118 |
|
119 | throw(): this;
|
120 | throw(msg: RegExp | string | Function, properties?: {}): this;
|
121 | throw(properties: {}): this;
|
122 |
|
123 | throwError(): this;
|
124 | throwError(msg: RegExp | string | Function, properties?: {}): this;
|
125 | throwError(properties: {}): this;
|
126 |
|
127 |
|
128 | match(
|
129 | obj: RegExp | ((value: any, key: any) => boolean) | ((value: any, key: any) => void) | {},
|
130 | description?: string
|
131 | ): this;
|
132 | matchEach(
|
133 | obj: RegExp | ((value: any, key: any) => boolean) | ((value: any, key: any) => void) | {},
|
134 | description?: string
|
135 | ): this;
|
136 | matchEvery(
|
137 | obj: RegExp | ((value: any, key: any) => boolean) | ((value: any, key: any) => void) | {},
|
138 | description?: string
|
139 | ): this;
|
140 | matchAny(
|
141 | obj: RegExp | ((value: any, key: any) => boolean) | ((value: any, key: any) => void) | {},
|
142 | description?: string
|
143 | ): this;
|
144 | matchSome(
|
145 | obj: RegExp | ((value: any, key: any) => boolean) | ((value: any, key: any) => void) | {},
|
146 | description?: string
|
147 | ): this;
|
148 |
|
149 | //number
|
150 | NaN(): this;
|
151 | Infinity(): this;
|
152 | within(start: number, finish: number, description?: string): this;
|
153 | approximately(value: number, delta: number, description?: string): this;
|
154 | above(value: number, description?: string): this;
|
155 | greaterThan(value: number, description?: string): this;
|
156 | below(value: number, description?: string): this;
|
157 | lessThan(value: number, description?: string): this;
|
158 | aboveOrEqual(value: number, description?: string): this;
|
159 | greaterThanOrEqual(value: number, description?: string): this;
|
160 | belowOrEqual(value: number, description?: string): this;
|
161 | lessThanOrEqual(value: number, description?: string): this;
|
162 |
|
163 | //promise
|
164 | Promise(): this;
|
165 |
|
166 | fulfilled(): Promise<any>;
|
167 | resolved(): Promise<any>;
|
168 | rejected(): Promise<any>;
|
169 |
|
170 | fulfilledWith(obj: any): Promise<any>;
|
171 | resolvedWith(obj: any): Promise<any>;
|
172 | rejectedWith(msg: RegExp | string | Error, properties?: {}): Promise<any>;
|
173 | rejectedWith(properties: {}): Promise<any>;
|
174 | finally: PromisedAssertion;
|
175 | eventually: PromisedAssertion;
|
176 |
|
177 | // property
|
178 | propertyWithDescriptor(name: string, descriptor: {}): this;
|
179 |
|
180 | property(name: string, value?: any): this;
|
181 | properties(...names: string[]): this;
|
182 | properties(names: string[]): this;
|
183 | properties(props: {}): this;
|
184 |
|
185 | length(value: number, description?: string): this;
|
186 | lengthOf(value: number, description?: string): this;
|
187 |
|
188 | ownProperty(name: string, description?: string): this;
|
189 | hasOwnProperty(name: string, description?: string): this;
|
190 |
|
191 | empty(): this;
|
192 |
|
193 | keys(...keys: any[]): this;
|
194 | key(key: any): this;
|
195 |
|
196 | value(key: any, value: any): this;
|
197 |
|
198 | size(value: number): this;
|
199 |
|
200 | propertyByPath(...path: string[]): this;
|
201 | propertyByPath(path: string[]): this;
|
202 |
|
203 | //string
|
204 | startWith(prefix: string, description?: string): this;
|
205 | endWith(postfix: string, description?: string): this;
|
206 |
|
207 | //type
|
208 | Number(): this;
|
209 | arguments(): this;
|
210 | Arguments(): this;
|
211 | type(typeName: string, description?: string): this;
|
212 | instanceof(constructor: Function, description?: string): this;
|
213 | instanceOf(constructor: Function, description?: string): this;
|
214 | Function(): this;
|
215 | Object(): this;
|
216 | String(): this;
|
217 | Array(): this;
|
218 | Boolean(): this;
|
219 | Error(): this;
|
220 | Date(): this;
|
221 | null(): this;
|
222 | Null(): this;
|
223 | class(className: string): this;
|
224 | Class(className: string): this;
|
225 | undefined(): this;
|
226 | Undefined(): this;
|
227 | iterable(): this;
|
228 | iterator(): this;
|
229 | generator(): this;
|
230 | }
|
231 |
|
232 | interface PromisedAssertion extends Assertion, PromiseLike<any> {}
|
233 | }
|
234 |
|
235 | declare global {
|
236 | interface Object {
|
237 | should: should.Assertion;
|
238 | }
|
239 | }
|
240 |
|
241 | export as namespace should;
|
242 |
|
243 | export = should;
|
244 |
|
\ | No newline at end of file |