@jest-mock/express
Version:
A lightweight Jest mock for unit testing Express
17 lines (16 loc) • 674 B
TypeScript
import type { Response, NextFunction } from 'express';
import type { MockResponse } from './index';
/**
* Returns a mocked version of key **Express** components, including:
* - a mocked **Express** `Response`, with mocked functions (chainable) and default values.
* - a mocked `next()` convenience function.
* - `mockClear()` to clear all internal **Jest** functions including `next()`
* - `clearMockRes()` an alias for `mockClear()`
*/
export declare const getMockRes: <T extends Response<any, Record<string, any>>>(values?: MockResponse) => {
res: T;
next: NextFunction;
mockClear: () => void;
clearMockRes: () => void;
};
export default getMockRes;