dashboardData.test.ts 1.41 KB
// REQ-USR-003: 主页静态 demo 数据(复刻原型 kpiRows / 角色树,D1/D2)
import { describe, it, expect } from 'vitest';
import {
  KPI_STATS,
  KPI_ROWS,
  ROLE_GROUPS,
  PROCESS_GROUPS,
} from '../../src/pages/home/HomePage/dashboardData';

describe('dashboardData', () => {
  it('KPI_STATS matches prototype head bar', () => {
    expect(KPI_STATS.todayPending).toBe(37428);
    expect(KPI_STATS.openTotal).toBe(56433);
  });

  it('KPI_ROWS first row replicates prototype kpiRows field names', () => {
    const first = KPI_ROWS[0];
    expect(first.role).toBe('核价人员');
    expect(first.navTypeFirst).toBe(true);
    expect(first.roleSpan).toBe(4);
    expect(first.sub).toBe('估价管理流程');
    expect(first.subSpan).toBe(5);
    expect(first.item).toBe('01/04【新增】新报价单');
  });

  it('ROLE_GROUPS includes 所有部门 37428 and 客服部 30127', () => {
    const all = ROLE_GROUPS.find((g) => g.label === '所有部门');
    const kf = ROLE_GROUPS.find((g) => g.label === '客服部');
    expect(all?.count).toBe(37428);
    expect(kf?.count).toBe(30127);
  });

  it('PROCESS_GROUPS includes 估价管理流程 17 and 订单下达流程 30118', () => {
    const est = PROCESS_GROUPS.find((g) => g.label === '估价管理流程');
    const ord = PROCESS_GROUPS.find((g) => g.label === '订单下达流程');
    expect(est?.count).toBe(17);
    expect(ord?.count).toBe(30118);
  });
});