feat(i18n): localise CV dashboard

This commit is contained in:
cesnimda
2026-08-28 20:27:33 +02:00
parent cf549d6ed1
commit 557121ad31
3 changed files with 123 additions and 35 deletions
@@ -47,9 +47,12 @@ function renderPage() {
}
beforeEach(() => {
window.localStorage.removeItem('uiLanguage');
jest.clearAllMocks();
});
afterEach(() => window.localStorage.removeItem('uiLanguage'));
test('lists existing CVs from the variants API', async () => {
mockedApi.get.mockResolvedValueOnce({
data: [
@@ -87,6 +90,19 @@ test('shows the empty state and creates a CV then navigates to the editor', asyn
await waitFor(() => expect(mockNavigate).toHaveBeenCalledWith('/career/builder/42'));
});
test('CV dashboard and create flow render in Bokmål', async () => {
window.localStorage.setItem('uiLanguage', 'nb');
mockedApi.get.mockResolvedValueOnce({ data: [] } as any);
renderPage();
expect(await screen.findByText('Ingen CV-er ennå')).toBeInTheDocument();
fireEvent.click(screen.getAllByRole('button', { name: 'Ny CV' })[0]);
expect(await screen.findByRole('dialog', { name: 'Opprett en CV' })).toBeInTheDocument();
expect(screen.getByLabelText('CV-navn')).toHaveValue('CV uten tittel');
expect(screen.getByText('Velg en mal')).toBeInTheDocument();
});
test('CV deletion requires confirmation and supports cancellation', async () => {
mockedApi.get.mockResolvedValueOnce({ data: [
{ id: 1, name: 'Frontend CV', themeId: 'modern', publicSlug: 'abc', isPublic: false, version: 2, jobApplicationId: null, updatedAtUtc: new Date().toISOString() },