Mocked Response
export class MockedResponse {
public mockedRender: any;
public mockedStatus: any;
public mockedType: any;
public mockedEnd: any;
public mockedSend: any;
constructor() {
this.mockedRender = jest.fn();
this.mockedStatus = jest.fn();
this.mockedType = jest.fn();
this.mockedEnd = jest.fn();
this.mockedSend = jest.fn();
return this;
}
public resetMocked() {
this.mockedRender.mockReset();
this.mockedStatus.mockReset();
this.mockedType.mockReset();
this.mockedEnd.mockReset();
this.mockedSend.mockReset();
}
public render(view: string, callback?: (err: Error, html: string) => void) {
this.mockedRender(view);
}
public send(body?: any) {
this.mockedSend(body);
}
public status(code: number) {
this.mockedStatus(code);
return {
send: this.mockedSend,
};
}
public type(type: string) {
this.mockedType(type);
}
public end() {
this.mockedEnd();
}
}