feat(applications): preserve submitted packages
This commit is contained in:
@@ -62,6 +62,7 @@ function routeGet(overrides: Record<string, any> = {}) {
|
||||
mockedApi.get.mockImplementation((url: string) => {
|
||||
if (url.endsWith("/tailoring")) return Promise.resolve({ data: overrides.tailoring ?? tailoring } as any);
|
||||
if (url.endsWith("/cover-letter")) return Promise.resolve({ data: overrides.coverLetter ?? coverLetter } as any);
|
||||
if (url.endsWith("/submitted-packages")) return Promise.resolve({ data: overrides.submittedPackages ?? [] } as any);
|
||||
return Promise.resolve({ data: overrides.cv ?? cv } as any);
|
||||
});
|
||||
}
|
||||
@@ -126,6 +127,21 @@ test("tailoring asks for a career profile when there is none", async () => {
|
||||
expect(await screen.findByText(/Build your career profile/i)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test("submitted package capture appends an immutable history entry", async () => {
|
||||
routeGet();
|
||||
mockedApi.post.mockResolvedValue({ data: {
|
||||
id: 12, version: 1, cvVariantId: 3, cvVariantName: "Backend CV", cvVariantVersion: 4,
|
||||
cvThemeId: "nordic", hasCv: true, hasCoverLetter: true, createdAtUtc: "2026-08-31T12:00:00Z", attachments: [],
|
||||
} } as any);
|
||||
|
||||
render(<ApplicationCvSection jobId={7} />);
|
||||
fireEvent.click(await screen.findByRole("button", { name: /Freeze current package/i }));
|
||||
|
||||
await waitFor(() => expect(mockedApi.post).toHaveBeenCalledWith("/jobapplications/7/submitted-packages"));
|
||||
expect(await screen.findByText("Submission package v1")).toBeInTheDocument();
|
||||
expect(screen.getByText(/Backend CV · v4/)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
// ---------- Cover letter ----------
|
||||
|
||||
test("cover letter loads the current text and its history", async () => {
|
||||
|
||||
Reference in New Issue
Block a user