From be93bda38afca37a234a96e726987d0fa274afe1 Mon Sep 17 00:00:00 2001 From: Alexandre Bodin Date: Tue, 5 Sep 2023 23:38:03 +0200 Subject: [PATCH] Refactor testing to work with ts --- .../admin/create-user/__tests__/admin.create-user.test.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/core/strapi/src/commands/actions/admin/create-user/__tests__/admin.create-user.test.ts b/packages/core/strapi/src/commands/actions/admin/create-user/__tests__/admin.create-user.test.ts index 297fabc0ed..8c3b11fcec 100644 --- a/packages/core/strapi/src/commands/actions/admin/create-user/__tests__/admin.create-user.test.ts +++ b/packages/core/strapi/src/commands/actions/admin/create-user/__tests__/admin.create-user.test.ts @@ -319,15 +319,17 @@ describe('admin:create command', () => { const firstname = 'John'; const lastname = 'Doe'; - const mockInquiry = jest.spyOn(inquirer, 'prompt').mockResolvedValue(async () => ({ + const mockInquiry = jest.spyOn(inquirer, 'prompt').mockReturnValue({ email, password, firstname, lastname, confirm: true, - })); + } as any); - const mockExit = jest.spyOn(process, 'exit').mockImplementation(() => undefined as never); + const mockExit = jest.spyOn(process, 'exit').mockImplementation(() => { + throw new Error('exit'); + }); const consoleError = jest.spyOn(console, 'error').mockImplementation(() => {}); await createAdminCommand().catch((err) => {