mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
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
40 lines
1.4 KiB
TypeScript
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> {
|
|
}
|
|
|
|
}
|