Skip to content

Commit

Permalink
Fix types for .withDelayInMs
Browse files Browse the repository at this point in the history
  • Loading branch information
marcbachmann committed Aug 4, 2024
1 parent e0a61a4 commit 657f794
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
@@ -12,6 +12,7 @@ type ResponseSpecFunc = <T = any>(

declare namespace MockAdapter {
export interface RequestHandler {
withDelayInMs(delay: number): RequestHandler;
reply: ResponseSpecFunc;
replyOnce: ResponseSpecFunc;
passThrough(): MockAdapter;
4 changes: 4 additions & 0 deletions types/test.ts
Original file line number Diff line number Diff line change
@@ -125,6 +125,10 @@ namespace SupportsNetworkErrorOnce {
mock.onGet().networkErrorOnce();
}

namespace withDelayInMs {
mock.onGet().withDelayInMs(2000).reply(200, { data: 'foo' });
}

namespace AllowsFunctionReply {
mock.onGet().reply(config => {
return [200, { data: 'foo' }, { RequestedURL: config.url }];

0 comments on commit 657f794

Please sign in to comment.