Improve CV rewrite flow and parser accuracy

This commit is contained in:
2026-04-01 11:30:37 +02:00
parent f402213526
commit f22c6791a7
9 changed files with 581 additions and 55 deletions
+48
View File
@@ -108,6 +108,27 @@ beforeEach(() => {
],
} as any);
}
if (url === '/jobapplications') {
return Promise.resolve({
data: {
items: [
{
id: 42,
jobTitle: 'Senior Backend Engineer',
company: { id: 7, name: 'Acme Systems' },
status: 'Waiting',
dateApplied: '2026-03-20',
daysSince: 10,
description: 'Build API integrations and platform workflows.',
responseReceived: false,
},
],
total: 1,
page: 1,
pageSize: 100,
},
} as any);
}
return Promise.resolve({ data: {} } as any);
});
mockedApi.post.mockImplementation((url: string) => {
@@ -125,6 +146,9 @@ beforeEach(() => {
},
} as any);
}
if (url === '/profile-cv/rewrite-section') {
return Promise.resolve({ data: { text: 'Professional Summary\nClearer, sharper positioning for backend platform roles.' } } as any);
}
if (url === '/profile-cv/reprocess') {
return Promise.resolve({ data: { reprocessed: true } } as any);
}
@@ -201,6 +225,30 @@ test('profile page keeps raw extraction collapsed until expanded', async () => {
expect(copyButtons.some((button) => !button.hasAttribute('disabled'))).toBe(true);
});
test('profile page rewrite tools use selected template and saved job context', async () => {
renderPage();
expect(await screen.findByText(/cv style rewrite studio/i)).toBeInTheDocument();
fireEvent.click(screen.getByText(/harvard/i));
fireEvent.mouseDown(screen.getAllByRole('combobox')[1]);
fireEvent.click(await screen.findByText(/senior backend engineer · acme systems/i));
const rewriteButton = screen.getByRole('button', { name: /rewrite section/i });
fireEvent.click(rewriteButton);
await waitFor(() => {
expect(mockedApi.post).toHaveBeenCalledWith('/profile-cv/rewrite-section', expect.objectContaining({
sectionName: null,
style: 'harvard',
templateId: 'harvard',
jobApplicationId: 42,
}));
});
expect(await screen.findByText(/draft ready/i)).toBeInTheDocument();
expect(screen.getByText(/clearer, sharper positioning for backend platform roles/i)).toBeInTheDocument();
});
test('saving profile persists structured cv json', async () => {
renderPage();