test(auth): add password length boundary tests (7 fails, 8 passes)
Parameterized test verifying the exact boundary of the 8-character minimum password requirement. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -175,6 +175,25 @@ describe('SignupForm', () => {
|
|||||||
expect(screen.getByText('Mindestens 8 Zeichen')).toBeInTheDocument();
|
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', () => {
|
it('renders placeholders on inputs', () => {
|
||||||
render(SignupForm);
|
render(SignupForm);
|
||||||
expect(screen.getByPlaceholderText('z.B. Sarah')).toBeInTheDocument();
|
expect(screen.getByPlaceholderText('z.B. Sarah')).toBeInTheDocument();
|
||||||
|
|||||||
Reference in New Issue
Block a user