Skip to content

Commit

Permalink
feat: Use correct type RequestEvent for function argument of `onReq…
Browse files Browse the repository at this point in the history
…uest`
  • Loading branch information
Dominique Wirz committed Dec 21, 2020
1 parent ff8c85d commit 533ef42
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/request-call-count-mock.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { RequestHook } from 'testcafe';
import { ResponseMock } from 'testcafe-hammerhead';
import { ResponseMock, RequestEvent } from 'testcafe-hammerhead';
import { MockResponseBody } from './mock-response';

type MockResponse = {
Expand All @@ -19,9 +19,7 @@ export class RequestCallCountMock extends RequestHook {
this.mocks = mocks;
}

// Cause TestCafe types are not explicit enough
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
public onRequest(event: any): any {
public onRequest(event: RequestEvent): any {
const { body, statusCode, headers } = this.mocks[this.callCount] || this.mocks[this.mocks.length - 1];
event.setMock(
new ResponseMock(body as any, statusCode, {
Expand Down

0 comments on commit 533ef42

Please sign in to comment.