1 | # Installation
|
2 | > `npm install --save @types/supertest`
|
3 |
|
4 | # Summary
|
5 | This package contains type definitions for SuperTest (https://github.com/visionmedia/supertest).
|
6 |
|
7 | # Details
|
8 | Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/supertest.
|
9 | ## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/supertest/index.d.ts)
|
10 | ````ts
|
11 | // Type definitions for SuperTest v2.0.1
|
12 | // Project: https://github.com/visionmedia/supertest
|
13 | // Definitions by: Alex Varju <https://github.com/varju>
|
14 | // Petteri Parkkila <https://github.com/pietu>
|
15 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
16 | // TypeScript Version: 3.0
|
17 |
|
18 | import * as superagent from 'superagent';
|
19 |
|
20 | export = supertest;
|
21 |
|
22 | declare function supertest(app: any): supertest.SuperTest<supertest.Test>;
|
23 | declare namespace supertest {
|
24 | interface Response extends superagent.Response {}
|
25 |
|
26 | interface Request extends superagent.SuperAgentRequest {}
|
27 |
|
28 | type CallbackHandler = (err: any, res: Response) => void;
|
29 | interface Test extends superagent.SuperAgentRequest {
|
30 | app?: any;
|
31 | url: string;
|
32 | serverAddress(app: any, path: string): string;
|
33 | expect(status: number, callback?: CallbackHandler): this;
|
34 | expect(status: number, body: any, callback?: CallbackHandler): this;
|
35 | expect(checker: (res: Response) => any, callback?: CallbackHandler): this;
|
36 | expect(body: string, callback?: CallbackHandler): this;
|
37 | expect(body: RegExp, callback?: CallbackHandler): this;
|
38 | expect(body: Object, callback?: CallbackHandler): this;
|
39 | expect(field: string, val: string, callback?: CallbackHandler): this;
|
40 | expect(field: string, val: RegExp, callback?: CallbackHandler): this;
|
41 | end(callback?: CallbackHandler): this;
|
42 | }
|
43 |
|
44 | interface AgentOptions {
|
45 | ca?: any;
|
46 | }
|
47 | function agent(app?: any, options?: AgentOptions): SuperAgentTest;
|
48 |
|
49 | interface SuperTest<T extends superagent.SuperAgentRequest> extends superagent.SuperAgent<T> {}
|
50 | interface SuperTestWithHost<T extends superagent.SuperAgentRequest> extends SuperTest<T> {
|
51 | host(host: string): this;
|
52 | }
|
53 | type SuperAgentTest = SuperTestWithHost<Test> &
|
54 | Pick<
|
55 | Request,
|
56 | | 'use'
|
57 | | 'on'
|
58 | | 'set'
|
59 | | 'query'
|
60 | | 'type'
|
61 | | 'accept'
|
62 | | 'auth'
|
63 | | 'withCredentials'
|
64 | | 'retry'
|
65 | | 'ok'
|
66 | | 'redirects'
|
67 | | 'timeout'
|
68 | | 'buffer'
|
69 | | 'serialize'
|
70 | | 'parse'
|
71 | | 'ca'
|
72 | | 'key'
|
73 | | 'pfx'
|
74 | | 'cert'
|
75 | >;
|
76 | }
|
77 |
|
78 | ````
|
79 |
|
80 | ### Additional Details
|
81 | * Last updated: Mon, 21 Mar 2022 16:31:45 GMT
|
82 | * Dependencies: [@types/superagent](https://npmjs.com/package/@types/superagent)
|
83 | * Global values: none
|
84 |
|
85 | # Credits
|
86 | These definitions were written by [Alex Varju](https://github.com/varju), and [Petteri Parkkila](https://github.com/pietu).
|
87 |
|
\ | No newline at end of file |