DefinitelyTyped/supertest/index.d.ts
Ethan Resnick 8fadaf2b56 Supertest: bump version
Supertest depends on and exposes the interface of superagent.
Therefore, supertest updated its major version to 2.0 when it updated
its superagent dependency to superagent 2.0.

These type definitions also refer to the type definitions for
superagent 2.0, so they apply to supertest 2.0
2016-11-19 03:31:06 -08:00

40 lines
1.4 KiB
TypeScript

// Type definitions for SuperTest v2.0.1
// Project: https://github.com/visionmedia/supertest
// Definitions by: Alex Varju <https://github.com/varju/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import * as superagent from "superagent"
export = supertest;
declare function supertest(app: any): supertest.SuperTest<supertest.Test>;
declare 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: any, 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> {
}
}