From 3fd63c9a1f35440736ff50bac534a3cb29d87989 Mon Sep 17 00:00:00 2001 From: "Heather Logan (She/Her)" Date: Fri, 4 Aug 2023 11:43:25 +0100 Subject: [PATCH] Add a unit test --- backend/test/unit/openai.test.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 backend/test/unit/openai.test.js diff --git a/backend/test/unit/openai.test.js b/backend/test/unit/openai.test.js new file mode 100644 index 000000000..c381fef20 --- /dev/null +++ b/backend/test/unit/openai.test.js @@ -0,0 +1,9 @@ +const { OpenAIApi } = require("openai"); +const { setGptModel } = require("../../src/openai"); + +test("GIVEN a new model WHEN setting the GPT model THEN the model is set", () => { + const session = { gptModel: "gpt-4" }; + const model = "gpt-3.5-turbo"; + setGptModel(session, model); + expect(session.gptModel).toBe(model); +});