fix(cv): preserve rewrite language and qualify responsive document controls
This commit is contained in:
@@ -97,6 +97,30 @@ public sealed class CvAiReadinessTests
|
||||
Assert.Equal("ai:" + action, (await fixture.Db.CvVariantVersions.OrderBy(value => value.Version).LastAsync()).Source);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("improve", "en", true)]
|
||||
[InlineData("improve", "nb-NO", true)]
|
||||
[InlineData("grammar", "en", true)]
|
||||
[InlineData("grammar", "nb-NO", true)]
|
||||
[InlineData("shorten", "en", true)]
|
||||
[InlineData("shorten", "nb-NO", true)]
|
||||
[InlineData("suggest", "en", false)]
|
||||
[InlineData("suggest", "nb-NO", false)]
|
||||
public async Task Contextual_prompt_preserves_source_language_for_rewrites_only(string action, string language, bool preserve)
|
||||
{
|
||||
await using var fixture = new Fixture(); await fixture.Open();
|
||||
var response = await fixture.Controller().AiAssist(new(action, Source, null, null, language, fixture.Cv.Id, 1, "section:summary"), default);
|
||||
Assert.IsType<OkObjectResult>(response.Result);
|
||||
var instruction = Assert.IsType<string>(fixture.Ai.Invocations.Single(call => call.Method.Name == "GenerateSectionWithMetadataAsync").Arguments[0]);
|
||||
if (preserve)
|
||||
{
|
||||
Assert.Contains("Preserve the source language; this action is not translation.", instruction);
|
||||
Assert.DoesNotContain("Write in ", instruction);
|
||||
}
|
||||
else Assert.Contains($"Write in {language}.", instruction);
|
||||
await fixture.AssertUnchanged();
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(Paraphrase)]
|
||||
[InlineData("Maintained internal web applications.")]
|
||||
|
||||
Reference in New Issue
Block a user