From 559f52d9041fe818c769e5dc53ed1aad07596acf Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 1 Aug 2023 13:36:38 +0200 Subject: [PATCH] Lint --- .../src/automations/tests/openai.spec.ts | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/packages/server/src/automations/tests/openai.spec.ts b/packages/server/src/automations/tests/openai.spec.ts index 07ac73a7c8..88cb63b95b 100644 --- a/packages/server/src/automations/tests/openai.spec.ts +++ b/packages/server/src/automations/tests/openai.spec.ts @@ -22,6 +22,10 @@ jest.mock( })) ) +const mockedOpenAIApi = openai.OpenAIApi as jest.MockedClass< + typeof openai.OpenAIApi +> + const OPENAI_PROMPT = "What is the meaning of life?" describe("test the openai action", () => { @@ -68,11 +72,16 @@ describe("test the openai action", () => { }) it("should present the correct error message when an error is thrown from the createChatCompletion call", async () => { - ;(openai.OpenAIApi as any).mockImplementation(() => ({ - createChatCompletion: jest.fn(() => { - throw new Error("An error occurred while calling createChatCompletion") - }), - })) + mockedOpenAIApi.mockImplementation( + () => + ({ + createChatCompletion: jest.fn(() => { + throw new Error( + "An error occurred while calling createChatCompletion" + ) + }), + } as any) + ) const res = await setup.runStep("OPENAI", { prompt: OPENAI_PROMPT,