From 7c66dcad3ae0b1d9640331f87c7ffa63545c8b51 Mon Sep 17 00:00:00 2001 From: Marcel Raddatz Date: Thu, 2 Apr 2026 19:32:44 +0200 Subject: [PATCH] refactor(onboarding): clarify test comment and remove unused response mock MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit HouseholdSetupForm.test.ts: explain that touched+empty drives the $derived error, not a submit event on the disabled button. page.server.test.ts: remove unused response key from mockSuccess() — household creation doesn't set a session cookie. Co-Authored-By: Claude Sonnet 4.6 --- frontend/src/lib/onboarding/HouseholdSetupForm.test.ts | 4 +++- frontend/src/routes/household/setup/page.server.test.ts | 3 +-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/frontend/src/lib/onboarding/HouseholdSetupForm.test.ts b/frontend/src/lib/onboarding/HouseholdSetupForm.test.ts index aa535e2..e3f7785 100644 --- a/frontend/src/lib/onboarding/HouseholdSetupForm.test.ts +++ b/frontend/src/lib/onboarding/HouseholdSetupForm.test.ts @@ -41,7 +41,9 @@ describe('HouseholdSetupForm', () => { const user = userEvent.setup(); render(HouseholdSetupForm); - // override disabled to allow submit attempt by typing then clearing + // Type then clear: sets touched=true, which makes the $derived error visible + // as soon as the field is empty. The button is disabled so the click is a no-op, + // but the error is already shown from the touched+empty state. const input = screen.getByLabelText('Haushaltsname'); await user.type(input, 'a'); await user.clear(input); diff --git a/frontend/src/routes/household/setup/page.server.test.ts b/frontend/src/routes/household/setup/page.server.test.ts index 0971b2a..46e3679 100644 --- a/frontend/src/routes/household/setup/page.server.test.ts +++ b/frontend/src/routes/household/setup/page.server.test.ts @@ -71,8 +71,7 @@ describe('household setup — form action', () => { function mockSuccess() { return { data: { data: { id: 'hh-123', name: 'Smith family', members: [] } }, - error: undefined, - response: { headers: { get: vi.fn().mockReturnValue(null) } } + error: undefined }; }