Frontend: design system, navigation, auth guard, signup screen #33
@@ -175,6 +175,25 @@ describe('SignupForm', () => {
|
||||
expect(screen.getByText('Mindestens 8 Zeichen')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it.each([
|
||||
{ length: 7, shouldFail: true },
|
||||
{ length: 8, shouldFail: false }
|
||||
])('password with $length chars $shouldFail ? fails : passes validation', async ({ length, shouldFail }) => {
|
||||
const user = userEvent.setup();
|
||||
render(SignupForm);
|
||||
|
||||
await user.type(screen.getByLabelText('Dein Name'), 'Sarah');
|
||||
await user.type(screen.getByLabelText('E-Mail'), 'test@example.com');
|
||||
await user.type(screen.getByLabelText('Passwort'), 'a'.repeat(length));
|
||||
await user.click(screen.getByRole('button', { name: /konto erstellen/i }));
|
||||
|
||||
if (shouldFail) {
|
||||
expect(screen.getByText('Mindestens 8 Zeichen')).toBeInTheDocument();
|
||||
} else {
|
||||
expect(screen.queryByText('Mindestens 8 Zeichen')).not.toBeInTheDocument();
|
||||
}
|
||||
});
|
||||
|
||||
it('renders placeholders on inputs', () => {
|
||||
render(SignupForm);
|
||||
expect(screen.getByPlaceholderText('z.B. Sarah')).toBeInTheDocument();
|
||||
|
||||
Reference in New Issue
Block a user