Builder: updated unit test handling non-existent resume

This commit is contained in:
gianantoniopini
2021-01-22 17:25:04 +01:00
parent dc18e84bc2
commit 9a7bdb188b
5 changed files with 26 additions and 4 deletions

View File

@ -89,15 +89,27 @@ describe('Builder', () => {
describe('handles errors', () => {
describe('if resume does not exist', () => {
const waitForNavigateFunctionToHaveCompleted = async () => {
await waitFor(() => mockNavigateFunction.mock.results[0].value);
};
beforeEach(async () => {
await setup('xxxxxx', false, false);
});
it('navigates to Dashboard', async () => {
afterEach(async () => {
await waitForNavigateFunctionToHaveCompleted();
});
it('navigates to Dashboard and displays notification', async () => {
await waitFor(() =>
expect(mockNavigateFunction).toHaveBeenCalledTimes(1),
);
expect(mockNavigateFunction).toHaveBeenCalledWith('/app/dashboard');
await waitFor(() => {
expect(screen.getByRole('alert')).toBeInTheDocument();
});
});
});
});