UNPKG

1.1 kBTypeScriptView Raw
1import superagent = require("superagent");
2import stAgent = require("./lib/agent");
3import STest = require("./lib/test");
4import { AgentOptions as STAgentOptions, App } from "./types";
5
6declare const supertest: supertest.SuperTestStatic;
7
8declare namespace supertest {
9 type Response = superagent.Response;
10
11 type Request = superagent.SuperAgentRequest;
12
13 type CallbackHandler = superagent.CallbackHandler;
14
15 // eslint-disable-next-line @typescript-eslint/no-empty-interface
16 interface Test extends STest {}
17
18 // eslint-disable-next-line @typescript-eslint/no-empty-interface
19 interface Agent extends stAgent {}
20
21 interface Options {
22 http2?: boolean;
23 }
24
25 type AgentOptions = STAgentOptions;
26
27 type SuperTest<Req extends Test = Test> = superagent.SuperAgent<Req>;
28
29 type SuperAgentTest = SuperTest<Test>;
30
31 interface SuperTestStatic {
32 (app: App, options?: STAgentOptions): stAgent;
33 Test: typeof STest;
34 agent: typeof stAgent & ((app?: App, options?: STAgentOptions) => InstanceType<typeof stAgent>);
35 }
36}
37
38export = supertest;
39
\No newline at end of file