mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
46 lines
1.5 KiB
TypeScript
46 lines
1.5 KiB
TypeScript
// 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/DefinitelyTyped/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;
|
|
|
|
namespace 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;
|
|
}
|