admin/features/events/detail/admin-event-detail/AdminEventInsightsTabs.test.tsx
alisaza e1eaf5eff5 feat: initial ghabilee-admin backoffice app
Extract admin dashboard from ghabilee-frontend2 into a dedicated Next.js
app for backoffice.ghabilee.ir (no SEO indexing / Clarity).
2026-09-05 13:12:59 +03:30

62 lines
1.9 KiB
TypeScript

import { cleanup, render, screen } from '@testing-library/react'
import { afterEach, describe, expect, it } from 'vitest'
import type { EventManagementInsights } from '@/services/eventManagement'
import AdminEventFinancialTab from './AdminEventFinancialTab'
import AdminEventOverviewTab from './AdminEventOverviewTab'
afterEach(cleanup)
const insights = {
registrations: {
confirmedCount: 4,
checkedInCount: 2,
notCheckedInCount: 2,
pendingPaymentCount: 1,
waitlistCount: 3,
cancelledCount: 0,
expiredCount: 0,
refundedCount: 0,
noShowCount: 0,
remainingCapacity: 6,
},
financial: {
grossAmount: 1000000,
commissionAmount: 150000,
guestRefundAmount: 0,
netAmount: 850000,
heldAmount: 200000,
availableAmount: 650000,
settledAmount: 0,
},
} as EventManagementInsights
describe('AdminEventOverviewTab', () => {
it('shows the empty message when insights are missing', () => {
render(<AdminEventOverviewTab insights={null} />)
expect(screen.getByText('اطلاعاتی یافت نشد.')).toBeTruthy()
})
it('renders registration insight stats', () => {
render(<AdminEventOverviewTab insights={insights} />)
expect(screen.getByText('قطعی‌شده')).toBeTruthy()
expect(screen.getByText('حاضر شده')).toBeTruthy()
expect(screen.getByText('فهرست انتظار')).toBeTruthy()
})
})
describe('AdminEventFinancialTab', () => {
it('shows the empty message when insights are missing', () => {
render(<AdminEventFinancialTab insights={null} />)
expect(screen.getByText('اطلاعاتی یافت نشد.')).toBeTruthy()
})
it('renders financial insight stats', () => {
render(<AdminEventFinancialTab insights={insights} />)
expect(screen.getByText('فروش ناخالص')).toBeTruthy()
expect(screen.getByText('کمیسیون پلتفرم')).toBeTruthy()
expect(screen.getByText('تسویه‌شده')).toBeTruthy()
})
})