From f624de7edbd944918fbb2bca0f090ae658fb2f6c Mon Sep 17 00:00:00 2001 From: April Bates <124585201+april-bates-aleios@users.noreply.github.com> Date: Fri, 25 Aug 2023 15:26:38 +0100 Subject: [PATCH] fix: small change to remove uneccessary code from tests (#41) * fix: small change to remove uneccessary code from tests * fix: linting fix --- .../consumer/functions/consumer/__tests__/handler.test.ts | 5 +---- .../producer/functions/producer/__tests__/handler.test.ts | 5 +---- src/classes/__tests__/Event.test.ts | 7 +------ 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/example-architecture/consumer/functions/consumer/__tests__/handler.test.ts b/example-architecture/consumer/functions/consumer/__tests__/handler.test.ts index 9798f877..97f197a5 100644 --- a/example-architecture/consumer/functions/consumer/__tests__/handler.test.ts +++ b/example-architecture/consumer/functions/consumer/__tests__/handler.test.ts @@ -20,11 +20,8 @@ const { mockFrom } = vi.hoisted(() => ({ mockFrom: vi.fn(), })); -vi.mock("@aws-sdk/lib-dynamodb", async () => { - const actualModule = await vi.importActual("@aws-sdk/lib-dynamodb"); - +vi.mock("@aws-sdk/lib-dynamodb", () => { return { - ...actualModule, DynamoDBDocumentClient: vi.fn().mockReturnValue({ from: mockFrom, }), diff --git a/example-architecture/producer/functions/producer/__tests__/handler.test.ts b/example-architecture/producer/functions/producer/__tests__/handler.test.ts index 81049649..f41443de 100644 --- a/example-architecture/producer/functions/producer/__tests__/handler.test.ts +++ b/example-architecture/producer/functions/producer/__tests__/handler.test.ts @@ -9,11 +9,8 @@ mockPublish.mockReturnValue({ eventId: "mockEventId", }); -vi.mock("src/classes/Event", async () => { - const actualModule = await vi.importActual("src/classes/Event"); - +vi.mock("src/classes/Event", () => { return { - ...actualModule, Event: vi.fn().mockReturnValue({ publish: mockPublish, }), diff --git a/src/classes/__tests__/Event.test.ts b/src/classes/__tests__/Event.test.ts index 2481193e..4041275a 100644 --- a/src/classes/__tests__/Event.test.ts +++ b/src/classes/__tests__/Event.test.ts @@ -47,13 +47,8 @@ const { mockSend } = vi.hoisted(() => ({ mockSend: vi.fn(), })); -vi.mock("@aws-sdk/client-eventbridge", async () => { - const actualModule = await vi.importActual( - "@aws-sdk/client-eventbridge", - ); - +vi.mock("@aws-sdk/client-eventbridge", () => { return { - ...actualModule, EventBridgeClient: vi.fn().mockReturnValue({ send: mockSend, }),