From a8aa0d082233a48634cd127d1a6b65c35db265f3 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Tue, 5 Nov 2024 11:50:28 +0000 Subject: [PATCH] fix tests --- packages/server/src/automations/tests/openai.spec.ts | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/packages/server/src/automations/tests/openai.spec.ts b/packages/server/src/automations/tests/openai.spec.ts index 6b5e1fbb6a..2d84521cfc 100644 --- a/packages/server/src/automations/tests/openai.spec.ts +++ b/packages/server/src/automations/tests/openai.spec.ts @@ -1,7 +1,6 @@ import { getConfig, runStep, afterAll as _afterAll } from "./utilities" import { OpenAI } from "openai" import { - withEnv as withCoreEnv, setEnv as setCoreEnv, } from "@budibase/backend-core" import * as pro from "@budibase/pro" @@ -28,6 +27,7 @@ jest.mock("@budibase/pro", () => ({ ai: { LargeLanguageModel: { forCurrentTenant: jest.fn().mockImplementation(() => ({ + initialised: true, init: jest.fn(), run: jest.fn(), })), @@ -63,16 +63,6 @@ describe("test the openai action", () => { afterAll(_afterAll) - it("should present the correct error message when the OPENAI_API_KEY variable isn't set", async () => { - await withCoreEnv({ OPENAI_API_KEY: "" }, async () => { - let res = await runStep("OPENAI", { prompt: OPENAI_PROMPT }) - expect(res.response).toEqual( - "OpenAI API Key not configured - please add the OPENAI_API_KEY environment variable." - ) - expect(res.success).toBeFalsy() - }) - }) - it("should be able to receive a response from ChatGPT given a prompt", async () => { const res = await runStep("OPENAI", { prompt: OPENAI_PROMPT }) expect(res.response).toEqual("This is a test")