From 657f7942634d2846a1038e88de6dcc672c33e96c Mon Sep 17 00:00:00 2001 From: Marc Bachmann Date: Sun, 4 Aug 2024 21:02:28 +0200 Subject: [PATCH] Fix types for .withDelayInMs --- types/index.d.ts | 1 + types/test.ts | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/types/index.d.ts b/types/index.d.ts index a5afa6b..60940ab 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -12,6 +12,7 @@ type ResponseSpecFunc = ( declare namespace MockAdapter { export interface RequestHandler { + withDelayInMs(delay: number): RequestHandler; reply: ResponseSpecFunc; replyOnce: ResponseSpecFunc; passThrough(): MockAdapter; diff --git a/types/test.ts b/types/test.ts index e17a164..c1301b9 100644 --- a/types/test.ts +++ b/types/test.ts @@ -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 }];