fix(rd21): retain draft revisions and qualify conflict recovery
This commit is contained in:
@@ -18,7 +18,7 @@ const mockedApi = api as jest.Mocked<typeof api>;
|
||||
const en = translations.en;
|
||||
const nb = translations.nb;
|
||||
const profile = { ...emptyStructuredCv(), contact: { fullName: "Recorded owner" }, languages: [{ name: "Norwegian", level: "A2" }] };
|
||||
const source = { data: { profile, cvText: "Retained canonical raw", completeness: { percent: 50, missing: [], sections: [] } } };
|
||||
const source = { data: { revision: 7, profile, cvText: "Retained canonical raw", completeness: { percent: 50, missing: [], sections: [] } } };
|
||||
const versions = [
|
||||
{ version: 2, source: "manual", createdAtUtc: "2026-10-12T01:00:00Z", isCurrent: true },
|
||||
{ version: 1, source: "manual", createdAtUtc: "2026-10-11T01:00:00Z", isCurrent: false },
|
||||
@@ -69,7 +69,7 @@ beforeEach(() => {
|
||||
if (url === "/auth/me") return Promise.resolve({ data: { id: "owner", provider: "local", email: "owner@example.test" } } as any);
|
||||
if (url === "/career/profile/versions") return Promise.resolve({ data: versions } as any);
|
||||
if (url === "/profile-cv/runs") return Promise.resolve({ data: runs } as any);
|
||||
if (url.endsWith("/diff")) return Promise.resolve({ data: { runId: Number(url.split("/")[3]), status: "pending_review", diff } } as any);
|
||||
if (url.endsWith("/diff")) return Promise.resolve({ data: { runId: Number(url.split("/")[3]), status: "pending_review", revision: 7, diff } } as any);
|
||||
return Promise.reject(new Error(`Unexpected GET ${url}`));
|
||||
});
|
||||
mockedApi.put.mockResolvedValue(source as any);
|
||||
@@ -135,7 +135,7 @@ test("selecting then deselecting low-confidence data sends the explicit empty se
|
||||
fireEvent.click(chooseLow()); expect(chooseLow()).not.toBeChecked();
|
||||
runs = [{ ...run, status: "applied" }];
|
||||
fireEvent.click(screen.getByRole("button", { name: en.profileCvApplyChanges }));
|
||||
await waitFor(() => expect(mockedApi.post).toHaveBeenCalledWith("/profile-cv/runs/41/accept", { acceptedLowConfidenceIds: [] }));
|
||||
await waitFor(() => expect(mockedApi.post).toHaveBeenCalledWith("/profile-cv/runs/41/accept", { expectedVersion: 7, acceptedLowConfidenceIds: [] }));
|
||||
expect(mockedApi.post).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
@@ -145,7 +145,7 @@ test("held acceptance locks review choices and all canonical editors and prevent
|
||||
const apply = screen.getByRole("button", { name: en.profileCvApplyChanges }); apply.focus(); fireEvent.click(apply); fireEvent.click(apply);
|
||||
expect(screen.getByRole("article", { name: "File import 41" })).toHaveFocus();
|
||||
expect(mockedApi.post).toHaveBeenCalledTimes(1);
|
||||
expect(mockedApi.post).toHaveBeenCalledWith("/profile-cv/runs/41/accept", { acceptedLowConfidenceIds: ["Languages|french"] });
|
||||
expect(mockedApi.post).toHaveBeenCalledWith("/profile-cv/runs/41/accept", { expectedVersion: 7, acceptedLowConfidenceIds: ["Languages|french"] });
|
||||
expect(chooseLow()).toBeDisabled(); expect(screen.getByRole("button", { name: en.careerImportApplying })).toBeDisabled();
|
||||
navigate(en.careerWorkspaceProfileTab);
|
||||
expect(screen.getByLabelText(en.profileCvContactFullName)).toBeDisabled();
|
||||
@@ -241,7 +241,7 @@ test("a failed operation retry stays scoped and only resends the same operation
|
||||
test("Bokmål localizes comparison labels while preserving imported facts named like UI labels or object properties", async () => {
|
||||
localStorage.setItem("uiLanguage", "nb");
|
||||
const read = mockedApi.get.getMockImplementation()!;
|
||||
mockedApi.get.mockImplementation((url: string) => url.endsWith("/diff") ? Promise.resolve({ data: { runId: 41, diff: {
|
||||
mockedApi.get.mockImplementation((url: string) => url.endsWith("/diff") ? Promise.resolve({ data: { runId: 41, revision: 7, diff: {
|
||||
totalAdded: 2, totalUpdated: 0, totalLowConfidence: 1, hasChanges: true, categories: [
|
||||
{ category: "Projects", added: [{ id: "Projects|references", label: "References", confidence: "Medium", fieldChanges: [] }], updated: [], unchangedCount: 0, lowConfidenceCount: 0 },
|
||||
{ category: "Languages", added: [{ id: "Languages|constructor", label: "constructor", confidence: "Low", fieldChanges: [] }], updated: [], unchangedCount: 0, lowConfidenceCount: 1 },
|
||||
@@ -259,7 +259,7 @@ test("Bokmål localizes comparison labels while preserving imported facts named
|
||||
test("the known low-confidence contact placeholder is localized", async () => {
|
||||
localStorage.setItem("uiLanguage", "nb");
|
||||
const read = mockedApi.get.getMockImplementation()!;
|
||||
mockedApi.get.mockImplementation((url: string) => url.endsWith("/diff") ? Promise.resolve({ data: { runId: 41, diff: {
|
||||
mockedApi.get.mockImplementation((url: string) => url.endsWith("/diff") ? Promise.resolve({ data: { runId: 41, revision: 7, diff: {
|
||||
totalAdded: 0, totalUpdated: 1, totalLowConfidence: 1, hasChanges: true, categories: [
|
||||
{ category: "Contact", added: [], updated: [{ id: "Contact", label: "Contact details", confidence: "Low", fieldChanges: [{ field: "Email", oldValue: "current@example.test", newValue: "pending@example.test" }] }], unchangedCount: 0, lowConfidenceCount: 1 },
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user