Update dashboard KPIs for live show and auto-approval
This commit is contained in:
@@ -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', () => {
|
||||
|
||||
Reference in New Issue
Block a user