@types/mock-req-res
TypeScript icon, indicating that this package has built-in type declarations

1.1.6 • Public • Published

Installation

npm install --save @types/mock-req-res

Summary

This package contains type definitions for mock-req-res (https://github.com/davesag/mock-req-res#readme).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mock-req-res.

index.d.ts

import { Request, Response } from "express";
import { SinonSpy, SinonStub } from "sinon";

declare namespace mockReqRes {
    interface Dictionary<T> {
        [key: string]: T;
    }

    type RequestPayload = Dictionary<any>;

    type ResponsePayload = Dictionary<any>;

    interface RequestOutput extends Request {
        get: SinonStub;
    }

    interface ResponseOutput extends Response {
        cookie: SinonSpy;
        clearCookie: SinonSpy;
        download: SinonSpy;
        format: SinonSpy;
        getHeader: SinonSpy;
        json: SinonSpy;
        jsonp: SinonSpy;
        send: SinonSpy;
        sendFile: SinonSpy;
        sendStatus: SinonSpy;
        setHeader: SinonSpy;
        redirect: SinonSpy;
        render: SinonSpy;
        end: SinonSpy;
        set: SinonSpy;
        type: SinonSpy;
        get: SinonStub;
        status: SinonStub;
        vary: SinonStub;
    }

    function mockRequest(options?: RequestPayload): RequestOutput;

    function mockResponse(options?: ResponsePayload): ResponseOutput;

    interface Mock {
        mockRequest(options?: RequestPayload): RequestOutput;

        mockResponse(options?: ResponsePayload): ResponseOutput;
    }
}

declare function mockReqRes(): mockReqRes.Mock;

export = mockReqRes;

Additional Details

Credits

These definitions were written by Sandor Turanszky.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/mock-req-res

Weekly Downloads

9,881

Version

1.1.6

License

MIT

Unpacked Size

5.32 kB

Total Files

5

Last publish

Collaborators

  • types