fix(career): preserve reviewed profile values
Keep extraction heuristics out of manual save, version, and import paths so reviewed locations, URLs, dates, and languages round-trip unchanged.
This commit is contained in:
@@ -60,6 +60,46 @@ public sealed class CareerProfileControllerTests
|
||||
Assert.Equal(new[] { "C#", "SQL" }, dto.Profile.Skills);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Put_then_get_preserves_reviewed_free_form_fields()
|
||||
{
|
||||
var (controller, _, user) = Build();
|
||||
var profile = Sample();
|
||||
profile.Contact.Location = "Oslo, Norway and Remote across Europe";
|
||||
profile.Contact.Website = "https://example.test/portfolio/ada?view=full";
|
||||
profile.Contact.LinkedIn = "https://www.linkedin.com/in/ada-lovelace";
|
||||
profile.Jobs[0].Location = "Oslo, Norway and Remote across Europe";
|
||||
profile.Jobs[0].Start = "Spring 2020";
|
||||
profile.Jobs.Add(new StructuredCvJob { Location = "Remote across Europe", Start = "Before 2020" });
|
||||
profile.Languages.Add(new StructuredCvLanguage
|
||||
{
|
||||
Name = "Norwegian Sign Language",
|
||||
Level = "Professional working proficiency",
|
||||
Notes = "Used with distributed teams",
|
||||
});
|
||||
|
||||
var put = await controller.Put(new CareerProfileSaveRequest(profile, null), CancellationToken.None);
|
||||
var saved = Assert.IsType<CareerProfileDto>(Assert.IsType<OkObjectResult>(put.Result).Value).Profile;
|
||||
var get = await controller.Get(CancellationToken.None);
|
||||
var reloaded = Assert.IsType<CareerProfileDto>(Assert.IsType<OkObjectResult>(get.Result).Value).Profile;
|
||||
|
||||
foreach (var actual in new[] { saved, reloaded })
|
||||
{
|
||||
Assert.Equal("Oslo, Norway and Remote across Europe", actual.Contact.Location);
|
||||
Assert.Equal("https://example.test/portfolio/ada?view=full", actual.Contact.Website);
|
||||
Assert.Equal("https://www.linkedin.com/in/ada-lovelace", actual.Contact.LinkedIn);
|
||||
Assert.Equal("Oslo, Norway and Remote across Europe", actual.Jobs[0].Location);
|
||||
Assert.Equal("Spring 2020", actual.Jobs[0].Start);
|
||||
Assert.Equal("Remote across Europe", actual.Jobs[1].Location);
|
||||
Assert.Equal("Before 2020", actual.Jobs[1].Start);
|
||||
Assert.Equal("Norwegian Sign Language", actual.Languages[0].Name);
|
||||
Assert.Equal("Professional working proficiency", actual.Languages[0].Level);
|
||||
}
|
||||
|
||||
var projected = StructuredCvProfileJson.DeserializePersisted(user.ProfileCvStructureJson);
|
||||
Assert.Equal("https://example.test/portfolio/ada?view=full", projected.Contact.Website);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Get_reports_completeness_with_missing_sections()
|
||||
{
|
||||
@@ -86,6 +126,19 @@ public sealed class CareerProfileControllerTests
|
||||
Assert.IsType<BadRequestObjectResult>(put.Result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Put_rejects_an_over_limit_reviewed_contact_value_instead_of_discarding_it()
|
||||
{
|
||||
var (controller, _, _) = Build();
|
||||
var profile = Sample();
|
||||
profile.Contact.Website = $"https://example.test/{new string('a', 600)}";
|
||||
|
||||
var put = await controller.Put(new CareerProfileSaveRequest(profile, null), CancellationToken.None);
|
||||
|
||||
var badRequest = Assert.IsType<BadRequestObjectResult>(put.Result);
|
||||
Assert.Equal("A contact field exceeds the allowed length.", badRequest.Value);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Put_accepts_an_empty_work_in_progress_profile()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user