From 79b90c769ffc301511265782020ab7d590224c19 Mon Sep 17 00:00:00 2001 From: Peter Marsh Date: Wed, 4 Oct 2023 12:12:39 +0100 Subject: [PATCH] fixes tests which were broken by the new line --- backend/test/integration/langchain.test.ts | 8 ++++---- backend/test/unit/langchain.test.ts | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/backend/test/integration/langchain.test.ts b/backend/test/integration/langchain.test.ts index 16ee928c0..46ee03884 100644 --- a/backend/test/integration/langchain.test.ts +++ b/backend/test/integration/langchain.test.ts @@ -147,10 +147,10 @@ test("GIVEN the prompt evaluation model WHEN it is initialised THEN the promptEv ); expect(mockFromTemplate).toBeCalledTimes(2); expect(mockFromTemplate).toBeCalledWith( - promptInjectionEvalPrePrompt + promptInjectionEvalMainPrompt + `${promptInjectionEvalPrePrompt}\n${promptInjectionEvalMainPrompt}` ); expect(mockFromTemplate).toBeCalledWith( - maliciousPromptEvalPrePrompt + maliciousPromptEvalMainPrompt + `${maliciousPromptEvalPrePrompt}\n${maliciousPromptEvalMainPrompt}` ); }); @@ -165,7 +165,7 @@ test("GIVEN the QA model is not provided a prompt and currentLevel WHEN it is in initQAModel(level, prompt, apiKey); expect(mockFromLLM).toBeCalledTimes(1); expect(mockFromTemplate).toBeCalledTimes(1); - expect(mockFromTemplate).toBeCalledWith(qAPrePrompt + qAMainPrompt); + expect(mockFromTemplate).toBeCalledWith(`${qAPrePrompt}\n${qAMainPrompt}`); }); test("GIVEN the QA model is provided a prompt WHEN it is initialised THEN the llm is initialized and prompt is set to the correct prompt ", () => { @@ -179,7 +179,7 @@ test("GIVEN the QA model is provided a prompt WHEN it is initialised THEN the ll expect(mockFromLLM).toBeCalledTimes(1); expect(mockFromTemplate).toBeCalledTimes(1); expect(mockFromTemplate).toBeCalledWith( - `this is a test prompt. ${qAMainPrompt}` + `this is a test prompt. \n${qAMainPrompt}` ); }); diff --git a/backend/test/unit/langchain.test.ts b/backend/test/unit/langchain.test.ts index 953b97302..ac974a78c 100644 --- a/backend/test/unit/langchain.test.ts +++ b/backend/test/unit/langchain.test.ts @@ -60,7 +60,7 @@ test("GIVEN level is sandbox THEN correct filepath is returned", () => { test("GIVEN makePromptTemplate is called with no config prePrompt THEN correct prompt is returned", () => { makePromptTemplate("", "defaultPrePrompt", "mainPrompt", "noName"); - expect(mockFromTemplate).toBeCalledWith("defaultPrePrompt" + "mainPrompt"); + expect(mockFromTemplate).toBeCalledWith("defaultPrePrompt\nmainPrompt"); expect(mockFromTemplate).toBeCalledTimes(1); }); @@ -71,7 +71,7 @@ test("GIVEN makePromptTemplate is called with a prePrompt THEN correct prompt is "mainPrompt", "noName" ); - expect(mockFromTemplate).toBeCalledWith("configPrePrompt" + "mainPrompt"); + expect(mockFromTemplate).toBeCalledWith("configPrePrompt\nmainPrompt"); expect(mockFromTemplate).toBeCalledTimes(1); });