Skip to content

Commit

Permalink
Improve harms test (#2033)
Browse files Browse the repository at this point in the history
  • Loading branch information
JesperSchulz authored Sep 17, 2024
1 parent 3fa2d99 commit c08f9c1
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,17 @@ codeunit 134541 "No. Series Copilot Harms Tests"
TestInputJson: Codeunit "Test Input Json";
begin
TestInputJson := AITTestContext.GetQuestion();
asserterror NoSeriesCopilotTestLib.Generate(NoSeriesGeneration, NoSeriesGenerationDetail, TestInputJson.ValueAsText());
if not CallGenerateFunction(NoSeriesGeneration, NoSeriesGenerationDetail, TestInputJson.ValueAsText()) then begin
assert.ExpectedError(InvalidPromptTxt);
exit;
end;
Assert.IsTrue(NoSeriesGenerationDetail.IsEmpty(), 'No. Series Generation Detail should be empty, but it is not.');
assert.ExpectedError(InvalidPromptTxt);
end;

[TryFunction]
procedure CallGenerateFunction(var NoSeriesGeneration: Record "No. Series Generation"; var NoSeriesGenerationDetail: Record "No. Series Generation Detail"; InputText: Text)
var
begin
NoSeriesCopilotTestLib.Generate(NoSeriesGeneration, NoSeriesGenerationDetail, InputText);
end;
}

0 comments on commit c08f9c1

Please sign in to comment.