test: add Stage 3-5 component and layout test coverage
Add tests for: - PageLayout components: ContentCard, FilterCard, TableCard, TreeCard, PageLayout - AuthLayout layout component - LoginLogDetailDrawer and OperationLogDetailDrawer page components All 518 tests pass across 82 test files.
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
import { render, screen } from '@testing-library/react'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
import { TableCard } from './TableCard'
|
||||
|
||||
vi.mock('antd', () => ({
|
||||
Card: ({
|
||||
children,
|
||||
className,
|
||||
}: {
|
||||
children?: React.ReactNode
|
||||
className?: string
|
||||
}) => (
|
||||
<div data-testid="card" data-class={className}>
|
||||
{children}
|
||||
</div>
|
||||
),
|
||||
}))
|
||||
|
||||
describe('TableCard', () => {
|
||||
it('renders children content', () => {
|
||||
render(
|
||||
<TableCard>
|
||||
<div>table content</div>
|
||||
</TableCard>,
|
||||
)
|
||||
|
||||
expect(screen.getByText('table content')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('applies custom className', () => {
|
||||
render(
|
||||
<TableCard className="custom-table-class">
|
||||
<div>content</div>
|
||||
</TableCard>,
|
||||
)
|
||||
|
||||
expect(screen.getByTestId('card')).toHaveAttribute('data-class', expect.stringContaining('custom-table-class'))
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user