@types/supertest-as-promised
TypeScript icon, indicating that this package has built-in type declarations

2.0.42 • Public • Published

Installation

npm install --save @types/supertest-as-promised

Summary

This package contains type definitions for supertest-as-promised (https://github.com/WhoopInc/supertest-as-promised).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/supertest-as-promised.

index.d.ts

import * as PromiseBluebird from "bluebird";
import supertest = require("supertest");
import { Server } from "tls";

declare function supertestAsPromised(app: any): supertestAsPromised.SuperTest;

declare namespace supertestAsPromised {
    interface Request extends supertest.Request {
    }

    interface Response extends supertest.Response {
    }

    type CallbackHandler = (err: any, res: Response) => void;

    interface Test extends supertest.Request {
        toPromise(): PromiseBluebird<Response & Test>;
        timeout(): Promise<Response> & this;
        end(callback?: CallbackHandler): this;
        app: Server;
        url: string;

        serverAddress(app: Server, path: string): string;

        expect(status: number, callback?: CallbackHandler): this;
        expect(status: number, body: any, callback?: CallbackHandler): this;
        expect(checker: (res: Response) => 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(field: string, val: RegExp, callback?: CallbackHandler): this;
    }

    function agent(app?: any): SuperTest;

    interface SuperTest extends supertest.SuperTest<Test> {
    }
}
export = supertestAsPromised;

Additional Details

Credits

These definitions were written by Tanguy Krotoff.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/supertest-as-promised

Weekly Downloads

14,806

Version

2.0.42

License

MIT

Unpacked Size

5.8 kB

Total Files

5

Last publish

Collaborators

  • types