36 lines
1.5 KiB
TypeScript
36 lines
1.5 KiB
TypeScript
import { render, screen } from '@testing-library/react'
|
|
import PeopleStructureDashboard from './PeopleStructureDashboard'
|
|
|
|
jest.mock('./DepartmentShell', () => ({
|
|
__esModule: true,
|
|
default: ({ children }: { children: React.ReactNode }) => <div data-testid="department-shell">{children}</div>,
|
|
}))
|
|
|
|
jest.mock('@/components/organization/OrganizationWorkspace', () => ({
|
|
__esModule: true,
|
|
default: (props: Record<string, unknown>) => (
|
|
<div
|
|
data-testid="organization-workspace"
|
|
data-embedded={String(props.embedded)}
|
|
data-scope={String(props.scopeRootName)}
|
|
data-heading={String(props.heading)}
|
|
data-tree-as-secondary-sidebar={String(props.treeAsSecondarySidebar)}
|
|
>
|
|
{String(props.description)}
|
|
</div>
|
|
),
|
|
}))
|
|
|
|
describe('PeopleStructureDashboard', () => {
|
|
it('在部门工作台内复用真实组织架构并聚焦品牌中心', () => {
|
|
render(<PeopleStructureDashboard />)
|
|
|
|
expect(screen.getByTestId('department-shell')).toBeInTheDocument()
|
|
expect(screen.getByTestId('organization-workspace')).toHaveAttribute('data-embedded', 'true')
|
|
expect(screen.getByTestId('organization-workspace')).toHaveAttribute('data-scope', '品牌中心')
|
|
expect(screen.getByTestId('organization-workspace')).toHaveAttribute('data-heading', '人员架构')
|
|
expect(screen.getByTestId('organization-workspace')).toHaveAttribute('data-tree-as-secondary-sidebar', 'true')
|
|
expect(screen.getByText(/公司组织架构 · 品牌中心在职人员/)).toBeInTheDocument()
|
|
})
|
|
})
|