优化
This commit is contained in:
@@ -17,11 +17,11 @@ vi.mock('../api/dashboard', () => ({
|
||||
describe('DashboardView', () => {
|
||||
beforeEach(() => vi.clearAllMocks())
|
||||
|
||||
it('renders the four live metrics and keeps unfinished task actions non-operational', async () => {
|
||||
it('renders only the four live metrics', async () => {
|
||||
const wrapper = mount(DashboardView)
|
||||
await flushPromises()
|
||||
|
||||
expect(wrapper.text()).toContain('四项核心指标已接入实时业务数据')
|
||||
expect(wrapper.text()).toContain('核心指标来自实时业务数据')
|
||||
expect(wrapper.text()).toContain('数据更新时间:2026-09-11 12:00')
|
||||
expect(wrapper.findAll('.dashboard-metric')).toHaveLength(4)
|
||||
expect(wrapper.text()).toContain('12 票')
|
||||
@@ -29,31 +29,11 @@ describe('DashboardView', () => {
|
||||
expect(wrapper.text()).toContain('8 家')
|
||||
expect(wrapper.text()).toContain('7 票')
|
||||
expect(wrapper.text()).toContain('1 柜箱型未知')
|
||||
const taskActions = wrapper.findAll('.dashboard-task-action')
|
||||
expect(taskActions).toHaveLength(3)
|
||||
expect(taskActions.every((button) => button.attributes('disabled') !== undefined)).toBe(true)
|
||||
})
|
||||
|
||||
it('switches transport series and exposes the chart values as a data table', async () => {
|
||||
const wrapper = mount(DashboardView)
|
||||
const airButton = wrapper.findAll('button').find((button) => button.text() === '空运')
|
||||
|
||||
expect(airButton).toBeDefined()
|
||||
await airButton!.trigger('click')
|
||||
|
||||
expect(airButton!.attributes('aria-pressed')).toBe('true')
|
||||
expect(wrapper.text()).toContain('空运普货')
|
||||
const caption = wrapper.get('.dashboard-line-chart table caption')
|
||||
expect(caption.text()).toBe('空运近 30 天运单量演示数据')
|
||||
expect(wrapper.findAll('.dashboard-line-chart tbody tr')).toHaveLength(30)
|
||||
})
|
||||
|
||||
it('preserves semantic route names and values in the volume ranking', () => {
|
||||
const wrapper = mount(DashboardView)
|
||||
const ranking = wrapper.get('.dashboard-bars')
|
||||
|
||||
expect(ranking.attributes('role')).toBeUndefined()
|
||||
expect(ranking.text()).toContain('上海 → 洛杉矶')
|
||||
expect(ranking.text()).toContain('850')
|
||||
expect(wrapper.text()).not.toContain('近 30 天运单量趋势')
|
||||
expect(wrapper.text()).not.toContain('运单状态分布')
|
||||
expect(wrapper.text()).not.toContain('TOP10 航线货量')
|
||||
expect(wrapper.text()).not.toContain('收入构成')
|
||||
expect(wrapper.text()).not.toContain('待办事项')
|
||||
expect(wrapper.text()).not.toContain('静态演示数据')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user