From b3607ca47a8359cedd9787220a1f231354d5c4cd Mon Sep 17 00:00:00 2001 From: Marcel Raddatz Date: Thu, 2 Apr 2026 15:07:42 +0200 Subject: [PATCH] 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 --- frontend/src/lib/auth/SignupForm.test.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/frontend/src/lib/auth/SignupForm.test.ts b/frontend/src/lib/auth/SignupForm.test.ts index 842200f..897579d 100644 --- a/frontend/src/lib/auth/SignupForm.test.ts +++ b/frontend/src/lib/auth/SignupForm.test.ts @@ -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();