Add tasks toggle card

This commit is contained in:
Codex Agent
2026-01-16 14:58:24 +01:00
parent 1517eb8631
commit 9e4ea3dafb
4 changed files with 137 additions and 1 deletions

View File

@@ -57,6 +57,10 @@ vi.mock('../../context/EventContext', () => ({
}),
}));
vi.mock('../../auth/context', () => ({
useAuth: () => ({ user: { role: 'tenant_admin' } }),
}));
vi.mock('../../api', () => ({
getEvent: vi.fn().mockResolvedValue(fixtures.event),
getEvents: vi.fn().mockResolvedValue([fixtures.event]),
@@ -65,6 +69,7 @@ vi.mock('../../api', () => ({
getTaskCollections: vi.fn().mockResolvedValue({ data: fixtures.collections }),
getEmotions: vi.fn().mockResolvedValue(fixtures.emotions),
assignTasksToEvent: vi.fn(),
updateEvent: vi.fn().mockResolvedValue(fixtures.event),
updateTask: vi.fn(),
importTaskCollection: vi.fn(),
createTask: vi.fn(),
@@ -110,6 +115,13 @@ vi.mock('@tamagui/text', () => ({
SizableText: ({ children }: { children: React.ReactNode }) => <span>{children}</span>,
}));
vi.mock('@tamagui/switch', () => ({
Switch: Object.assign(
({ children }: { children: React.ReactNode }) => <div>{children}</div>,
{ Thumb: () => <div /> },
),
}));
vi.mock('@tamagui/list-item', () => ({
ListItem: ({ title, subTitle, iconAfter }: { title?: React.ReactNode; subTitle?: React.ReactNode; iconAfter?: React.ReactNode }) => (
<div>
@@ -162,6 +174,7 @@ vi.mock('../components/MobileShell', () => ({
vi.mock('../components/Primitives', () => ({
MobileCard: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,
PillBadge: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,
CTAButton: ({ label, onPress }: { label: string; onPress?: () => void }) => (
<button type="button" onClick={onPress}>
{label}
@@ -215,6 +228,7 @@ describe('MobileEventTasksPage', () => {
it('renders the task overview summary and quick jump chips', async () => {
render(<MobileEventTasksPage />);
expect(await screen.findByText('1. Activate tasks')).toBeInTheDocument();
expect(await screen.findByText('Task overview')).toBeInTheDocument();
expect(screen.getByText('Tasks total')).toBeInTheDocument();
expect(screen.getByText('Quick jump')).toBeInTheDocument();