forked from jbaroudi/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
supertest-as-promised.d.ts
45 lines (35 loc) · 1.53 KB
/
supertest-as-promised.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 as Promised v2.0.2
// Project: https://github.com/WhoopInc/supertest-as-promised
// Definitions by: Tanguy Krotoff <https://github.com/tkrotoff>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path='../superagent/superagent.d.ts' />
/// <reference path="../bluebird/bluebird.d.ts" />
declare module "supertest-as-promised" {
// Mostly copy-pasted from supertest.d.ts
import * as superagent from 'superagent';
import * as PromiseBluebird from 'bluebird';
function supertest(app: any): supertest.SuperTest;
module supertest {
function agent(app?: any): supertest.SuperTest;
interface SuperTest extends superagent.SuperAgent<Test> {
}
interface Promise<T> extends PromiseBluebird<T> {
toPromise(): PromiseBluebird<T>;
}
interface Test extends superagent.Request<Test> {
url: string;
serverAddress(app: any, path: string): string;
expect(status: number): Promise<supertest.Response>;
expect(status: number, body: string): Promise<supertest.Response>;
expect(body: string): Promise<supertest.Response>;
expect(body: RegExp): Promise<supertest.Response>;
expect(body: Object): Promise<supertest.Response>;
expect(field: string, val: string): Promise<supertest.Response>;
expect(field: string, val: RegExp): Promise<supertest.Response>;
expect(checker: (res: Response) => any): Promise<supertest.Response>;
}
interface Response extends superagent.Response {
}
}
export = supertest;
}