1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | import * as request from 'superagent';
|
9 |
|
10 |
|
11 | declare global {
|
12 | namespace Chai {
|
13 | interface ChaiStatic {
|
14 | request: ChaiHttpRequest;
|
15 | }
|
16 |
|
17 | interface ChaiHttpRequest {
|
18 | (server: any): ChaiHttp.Agent;
|
19 |
|
20 | agent(server: any): ChaiHttp.Agent;
|
21 |
|
22 | addPromises(promiseConstructor: PromiseConstructorLike): void;
|
23 | }
|
24 |
|
25 | interface Assertion {
|
26 | redirectTo(location: string|RegExp): Assertion;
|
27 |
|
28 | param(key: string, value?: string): Assertion;
|
29 |
|
30 | cookie(key: string, value?: string): Assertion;
|
31 |
|
32 | status(code: number): Assertion;
|
33 |
|
34 | statusCode(code: number): Assertion;
|
35 |
|
36 | header(key: string, value?: string | RegExp): Assertion;
|
37 |
|
38 | charset(charset: string): Assertion;
|
39 |
|
40 | headers: Assertion;
|
41 | json: Assertion;
|
42 | text: Assertion;
|
43 | html: Assertion;
|
44 | redirect: Assertion;
|
45 | }
|
46 |
|
47 | interface TypeComparison {
|
48 | ip: Assertion;
|
49 | }
|
50 | }
|
51 |
|
52 | namespace ChaiHttp {
|
53 | interface Response extends request.Response {}
|
54 | interface Agent extends request.SuperAgentStatic {
|
55 | keepOpen(): Agent;
|
56 | close(callback?: (err: any) => void): Agent;
|
57 | }
|
58 | }
|
59 | }
|
60 |
|
61 | declare function chaiHttp(chai: any, utils: any): void;
|
62 |
|
63 | export = chaiHttp;
|