import type { RelatedAppResponse } from '@/models/datasets'
import { render, screen } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import Statistics from '../statistics'
vi.mock('@/app/components/base/linked-apps-panel', () => ({
default: () =>
linked applications
,
}))
vi.mock('../../no-linked-apps-panel', () => ({
default: () => no linked applications
,
}))
describe('Statistics', () => {
it('shows document and related application counts', () => {
render(
,
)
expect(screen.getByText('12')).toBeInTheDocument()
expect(screen.getByText('3')).toBeInTheDocument()
})
it('shows linked applications from the related-apps control', async () => {
const user = userEvent.setup()
render(
,
)
await user.click(screen.getByRole('button', { name: 'common.datasetMenus.relatedApp' }))
expect(screen.getByText('linked applications')).toBeInTheDocument()
})
it('shows an empty state when there are no linked applications', async () => {
const user = userEvent.setup()
render()
await user.click(screen.getByRole('button', { name: 'common.datasetMenus.relatedApp' }))
expect(screen.getByText('no linked applications')).toBeInTheDocument()
})
})