Files
DefinitelyTyped/supertest/supertest.d.ts
Tanguy Krotoff 15852a7145 Update SuperTest to version 1.1.0
- Callback now always takes 2 arguments, see https://github.com/visionmedia/superagent/commit/e440274
- Override superagent.Request.end() so it takes the proper callback signature
2015-11-24 11:27:45 +01:00

41 lines
1.4 KiB
TypeScript

// 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/borisyankov/DefinitelyTyped
/// <reference path='../superagent/superagent.d.ts' />
declare module "supertest" {
import superagent = require('superagent');
type CallbackHandler = (err: any, res: supertest.Response) => void;
function supertest(app: any): supertest.SuperTest;
module supertest {
function agent(app?: any): supertest.SuperTest;
interface SuperTest extends superagent.SuperAgent<Test> {
}
interface Test extends superagent.Request<Test> {
url: string;
serverAddress(app: any, path: string): string;
expect(status: number, callback?: CallbackHandler): Test;
expect(status: number, body: string, callback?: CallbackHandler): Test;
expect(body: string, callback?: CallbackHandler): Test;
expect(body: RegExp, callback?: CallbackHandler): Test;
expect(body: Object, callback?: CallbackHandler): Test;
expect(field: string, val: string, callback?: CallbackHandler): Test;
expect(field: string, val: RegExp, callback?: CallbackHandler): Test;
expect(checker: (res: Response) => any): Test;
end(callback?: CallbackHandler): Test;
}
interface Response extends superagent.Response {
}
}
export = supertest;
}