refactor(onboarding): clarify test comment and remove unused response mock
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 <noreply@anthropic.com>
This commit was merged in pull request #34.
This commit is contained in:
@@ -41,7 +41,9 @@ describe('HouseholdSetupForm', () => {
|
|||||||
const user = userEvent.setup();
|
const user = userEvent.setup();
|
||||||
render(HouseholdSetupForm);
|
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');
|
const input = screen.getByLabelText('Haushaltsname');
|
||||||
await user.type(input, 'a');
|
await user.type(input, 'a');
|
||||||
await user.clear(input);
|
await user.clear(input);
|
||||||
|
|||||||
@@ -71,8 +71,7 @@ describe('household setup — form action', () => {
|
|||||||
function mockSuccess() {
|
function mockSuccess() {
|
||||||
return {
|
return {
|
||||||
data: { data: { id: 'hh-123', name: 'Smith family', members: [] } },
|
data: { data: { id: 'hh-123', name: 'Smith family', members: [] } },
|
||||||
error: undefined,
|
error: undefined
|
||||||
response: { headers: { get: vi.fn().mockReturnValue(null) } }
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user