Fix Registration tests

environments/review-renovate-m-t65ngm/deployments/2154
Alex Gleason 2023-01-05 17:34:47 -06:00
rodzic b98073ee8f
commit 83c93a6d51
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
1 zmienionych plików z 10 dodań i 3 usunięć

Wyświetl plik

@ -30,7 +30,10 @@ describe('<Registration />', () => {
fireEvent.submit(screen.getByTestId('button'), { preventDefault: () => {} }); fireEvent.submit(screen.getByTestId('button'), { preventDefault: () => {} });
}); });
await waitFor(() => {
expect(screen.getByTestId('toast')).toHaveTextContent(/welcome to/i); expect(screen.getByTestId('toast')).toHaveTextContent(/welcome to/i);
});
expect(screen.queryAllByRole('heading')).toHaveLength(0); expect(screen.queryAllByRole('heading')).toHaveLength(0);
}); });
}); });
@ -47,8 +50,10 @@ describe('<Registration />', () => {
fireEvent.submit(screen.getByTestId('button'), { preventDefault: () => {} }); fireEvent.submit(screen.getByTestId('button'), { preventDefault: () => {} });
}); });
await waitFor(() => {
expect(screen.getByTestId('toast')).toHaveTextContent(/this username has already been taken/i); expect(screen.getByTestId('toast')).toHaveTextContent(/this username has already been taken/i);
}); });
});
it('handles generic errors', async() => { it('handles generic errors', async() => {
__stub(mock => { __stub(mock => {
@ -61,9 +66,11 @@ describe('<Registration />', () => {
fireEvent.submit(screen.getByTestId('button'), { preventDefault: () => {} }); fireEvent.submit(screen.getByTestId('button'), { preventDefault: () => {} });
}); });
await waitFor(() => {
expect(screen.getByTestId('toast')).toHaveTextContent(/failed to register your account/i); expect(screen.getByTestId('toast')).toHaveTextContent(/failed to register your account/i);
}); });
}); });
});
describe('validations', () => { describe('validations', () => {
it('should undisable button with valid password', async() => { it('should undisable button with valid password', async() => {