Skip to content

Commit

Permalink
fixes tests which were broken by the new line
Browse files Browse the repository at this point in the history
  • Loading branch information
pmarsh-scottlogic committed Oct 4, 2023
1 parent 57f45ed commit 79b90c7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions backend/test/integration/langchain.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`
);
});

Expand All @@ -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 ", () => {
Expand All @@ -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}`
);
});

Expand Down
4 changes: 2 additions & 2 deletions backend/test/unit/langchain.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});

Expand All @@ -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);
});

Expand Down

0 comments on commit 79b90c7

Please sign in to comment.