Extract admin dashboard from ghabilee-frontend2 into a dedicated Next.js app for backoffice.ghabilee.ir (no SEO indexing / Clarity).
62 lines
1.9 KiB
TypeScript
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()
|
|
})
|
|
})
|