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