Update dashboard KPIs for live show and auto-approval
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-01-23 13:31:50 +01:00
parent 55608c311d
commit fda97b3c05
4 changed files with 85 additions and 33 deletions

View File

@@ -1,6 +1,6 @@
import React from 'react';
import { afterEach, describe, expect, it, vi } from 'vitest';
import { render, screen, waitFor } from '@testing-library/react';
import { render, screen, waitFor, within } from '@testing-library/react';
import { ADMIN_EVENTS_PATH } from '../../constants';
const fixtures = vi.hoisted(() => ({
@@ -148,7 +148,7 @@ vi.mock('../components/Primitives', () => ({
MobileCard: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,
CTAButton: ({ label }: { label: string }) => <button type="button">{label}</button>,
KpiStrip: ({ items }: { items: Array<{ label: string; value: string | number }> }) => (
<div>
<div data-testid="kpi-strip">
{items.map((item) => (
<span key={item.label}>{item.label}</span>
))}
@@ -324,6 +324,7 @@ describe('MobileDashboardPage', () => {
fixtures.activePackage.remaining_events = 3;
fixtures.event.tasks_count = 4;
fixtures.event.engagement_mode = undefined;
fixtures.event.settings = { location: 'Berlin' };
navigateMock.mockClear();
window.sessionStorage.clear();
});
@@ -368,9 +369,23 @@ describe('MobileDashboardPage', () => {
it('shows the activity pulse strip', () => {
render(<MobileDashboardPage />);
expect(screen.getAllByText('Photos').length).toBeGreaterThan(0);
expect(screen.getAllByText('Guests').length).toBeGreaterThan(0);
expect(screen.getAllByText('Pending').length).toBeGreaterThan(0);
const strip = screen.getByTestId('kpi-strip');
expect(within(strip).getAllByText('Photos').length).toBeGreaterThan(0);
expect(within(strip).getAllByText('Guests').length).toBeGreaterThan(0);
expect(within(strip).getAllByText('Pending').length).toBeGreaterThan(0);
expect(within(strip).getAllByText('Live Show approved').length).toBeGreaterThan(0);
});
it('replaces pending with likes when auto-approval is enabled', () => {
fixtures.event.settings = { location: 'Berlin', guest_upload_visibility: 'immediate' };
render(<MobileDashboardPage />);
const strip = screen.getByTestId('kpi-strip');
expect(within(strip).queryByText('Pending')).not.toBeInTheDocument();
expect(within(strip).getAllByText('Likes total').length).toBeGreaterThan(0);
});
it('shows shortcut sections for members', () => {