forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsupertest.d.ts
45 lines (34 loc) · 1.45 KB
/
supertest.d.ts
1
2
3
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
36
37
38
39
40
41
42
43
44
45
// Type definitions for SuperTest v1.1.0
// Project: https://github.com/visionmedia/supertest
// Definitions by: Alex Varju <https://github.com/varju/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path='../superagent/superagent.d.ts' />
declare module "supertest" {
import * as superagent from "superagent"
function supertest(app: any): supertest.SuperTest<supertest.Test>;
namespace supertest {
interface Response extends superagent.Response {
}
interface Request extends superagent.Request {
}
type CallbackHandler = (err: any, res: Response) => void;
interface Test extends Request {
app?: any;
url: string;
serverAddress(app: any, path: string): string;
expect(status: number, callback?: CallbackHandler): this;
expect(status: number, body: string, callback?: CallbackHandler): this;
expect(body: string, callback?: CallbackHandler): this;
expect(body: RegExp, callback?: CallbackHandler): this;
expect(body: Object, callback?: CallbackHandler): this;
expect(field: string, val: string, callback?: CallbackHandler): this;
expect(fzield: string, val: RegExp, callback?: CallbackHandler): this;
expect(checker: (res: Response) => any): this;
end(callback?: CallbackHandler): this;
}
function agent(app?: any): SuperTest<Test>;
interface SuperTest<T> extends superagent.SuperAgent<T> {
}
}
export = supertest;
}