feat(cv): qualify templates and reliable local import processing
This commit is contained in:
@@ -235,7 +235,7 @@ test('held CV creation locks the draft and gallery, then keeps a failed draft fo
|
||||
expect(mockNavigate).not.toHaveBeenCalled();
|
||||
|
||||
fireEvent.click(within(dialog).getByRole('button', { name: 'Create CV' }));
|
||||
await waitFor(() => expect(mockedApi.post).toHaveBeenLastCalledWith('/cv/variants', { name: 'Application-specific CV', settings: { ...emptyCvVariantSettings('clean'), sectionsExplicit: true, includeProfileContact: false } }));
|
||||
await waitFor(() => expect(mockedApi.post).toHaveBeenLastCalledWith('/cv/variants', { name: 'Application-specific CV', settings: { ...emptyCvVariantSettings('clean'), designVersion: 2, sectionsExplicit: true, includeProfileContact: false } }));
|
||||
await waitFor(() => expect(mockNavigate).toHaveBeenCalledWith('/career/builder/42'));
|
||||
});
|
||||
|
||||
@@ -252,7 +252,7 @@ test('a locked CV template remains identifiable and cannot change the creation r
|
||||
fireEvent.keyDown(premium, { key: 'Enter' });
|
||||
expect(within(dialog).getByRole('button', { name: 'Modern' })).toHaveAttribute('aria-pressed', 'true');
|
||||
fireEvent.click(within(dialog).getByRole('button', { name: 'Create CV' }));
|
||||
await waitFor(() => expect(mockedApi.post).toHaveBeenCalledWith('/cv/variants', expect.objectContaining({ settings: { ...emptyCvVariantSettings('modern'), sectionsExplicit: true, includeProfileContact: false } })));
|
||||
await waitFor(() => expect(mockedApi.post).toHaveBeenCalledWith('/cv/variants', expect.objectContaining({ settings: { ...emptyCvVariantSettings('modern'), designVersion: 2, sectionsExplicit: true, includeProfileContact: false } })));
|
||||
});
|
||||
|
||||
test('a held duplicate blocks another action for the same CV and shows the persisted refreshed copy', async () => {
|
||||
@@ -344,7 +344,8 @@ test('a failed creation keeps its draft and translates its failure after closing
|
||||
expect(await within(dialog).findByRole('alert')).toHaveTextContent('Could not create a CV.');
|
||||
fireEvent.click(within(dialog).getByRole('button', { name: 'Cancel' }));
|
||||
await waitFor(() => expect(screen.queryByRole('dialog')).not.toBeInTheDocument());
|
||||
const reads = mockedApi.get.mock.calls.length;
|
||||
const profileReads = () => mockedApi.get.mock.calls.filter(([url]) => url === '/cv/variants' || url === '/cv/themes').length;
|
||||
const reads = profileReads();
|
||||
act(() => { window.dispatchEvent(new StorageEvent('storage', { key: 'uiLanguage', newValue: 'nb' })); });
|
||||
fireEvent.click(screen.getByRole('button', { name: 'Ny CV' }));
|
||||
const reopened = await screen.findByRole('dialog', { name: 'Opprett en CV' });
|
||||
@@ -352,7 +353,7 @@ test('a failed creation keeps its draft and translates its failure after closing
|
||||
expect(within(reopened).getByRole('button', { name: 'Clean' })).toHaveAttribute('aria-pressed', 'true');
|
||||
expect(within(reopened).getByRole('alert')).toHaveTextContent('Kunne ikke opprette en CV.');
|
||||
expect(within(reopened).queryByText('Could not create a CV.')).not.toBeInTheDocument();
|
||||
expect(mockedApi.get).toHaveBeenCalledTimes(reads);
|
||||
expect(profileReads()).toBe(reads);
|
||||
expect(mockedApi.post).toHaveBeenCalledTimes(1);
|
||||
expect(mockNavigate).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user