Fix demo task readiness and gate event creation
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
tests / ui (push) Has been cancelled

This commit is contained in:
Codex Agent
2026-02-05 11:26:07 +01:00
parent 7262617897
commit 04c399aeb6
14 changed files with 318 additions and 36 deletions

View File

@@ -63,11 +63,13 @@ vi.mock('../hooks/useBackNavigation', () => ({
}));
const selectEventMock = vi.fn();
const refetchMock = vi.fn();
vi.mock('../../context/EventContext', () => ({
useEventContext: () => ({
activeEvent: fixtures.event,
selectEvent: selectEventMock,
refetch: refetchMock,
}),
}));
@@ -245,7 +247,12 @@ vi.mock('../components/FormControls', () => ({
}));
vi.mock('../components/Sheet', () => ({
MobileSheet: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,
MobileSheet: ({ children, footer }: { children: React.ReactNode; footer?: React.ReactNode }) => (
<div>
{children}
{footer}
</div>
),
}));
vi.mock('../components/Tag', () => ({
@@ -336,4 +343,23 @@ describe('MobileEventTasksPage', () => {
expect(screen.queryByLabelText('Add')).not.toBeInTheDocument();
});
});
it('refetches events after creating a task', async () => {
refetchMock.mockClear();
(api.createTask as unknown as { mockResolvedValueOnce: (value: any) => void }).mockResolvedValueOnce({ id: 99 });
render(<MobileEventTasksPage />);
expect(await screen.findByText('Photo tasks for guests')).toBeInTheDocument();
fireEvent.change(screen.getByPlaceholderText('z.B. Erstes Gruppenfoto'), {
target: { value: 'New Task' },
});
fireEvent.click(screen.getAllByRole('button', { name: 'Fotoaufgabe speichern' })[0]);
await waitFor(() => {
expect(refetchMock).toHaveBeenCalled();
});
});
});