From eaefa0b650220def3ab80d0e3b99a83974062607 Mon Sep 17 00:00:00 2001 From: didinele Date: Thu, 25 Feb 2021 20:49:27 +0200 Subject: [PATCH 1/2] fix(IRouter): return types --- libs/routers/src/IRouter.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libs/routers/src/IRouter.ts b/libs/routers/src/IRouter.ts index 877db8e..e498501 100644 --- a/libs/routers/src/IRouter.ts +++ b/libs/routers/src/IRouter.ts @@ -1,9 +1,9 @@ import type { File, StringRecord, RequestBodyData } from '@cordis/rest'; export type IRouter = { - get(options?: { query?: Q }): T; - delete(options?: { data?: D; reason?: string }): T; - patch(options: { data: D; reason?: string }): T; - put(options: { data: D; reason?: string }): T; - post(options: { data: D; reason?: string; files?: File[] }): T; + get(options?: { query?: Q }): Promise; + delete(options?: { data?: D; reason?: string }): Promise; + patch(options: { data: D; reason?: string }): Promise; + put(options: { data: D; reason?: string }): Promise; + post(options: { data: D; reason?: string; files?: File[] }): Promise; } & { [key: string]: IRouter }; From 33a210728ea36534c61b92fde96372f59633ab64 Mon Sep 17 00:00:00 2001 From: didinele Date: Thu, 25 Feb 2021 20:52:29 +0200 Subject: [PATCH 2/2] fix(restRouter/test): await request promise --- libs/routers/src/restRouter.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/routers/src/restRouter.test.ts b/libs/routers/src/restRouter.test.ts index 5e63bc8..2ce6285 100644 --- a/libs/routers/src/restRouter.test.ts +++ b/libs/routers/src/restRouter.test.ts @@ -16,8 +16,8 @@ afterEach(() => { mockedMake.mockClear(); }); -test('basic routing', () => { - router.users['123'].get(); +test('basic routing', async () => { + await router.users['123'].get(); expect(mockedMake).toHaveBeenCalledTimes(1); expect(mockedMake).toHaveBeenCalledWith({ method: 'get', path: '/users/123' });