devperf/frontend/__tests__/components/KPIRadarChart.test.ts
zyc 44464dd334 feat: DevPerf Dashboard 研发人效看板 v1.0
- 后端:Bun + Hono + Drizzle ORM + SQLite
- 前端:Vue 3 + Naive UI + ECharts
- 项目管理:创建项目 + 绑定 Git 仓库
- OKR 系统:目标/关键结果 CRUD + 进度追踪
- Git 同步:Gitea API 自动同步 commit/PR + 作者关联
- 数据看板:项目 OKR 进度 + KR 状态分布 + 代码活动
- 权限体系:admin/manager/developer/viewer 四级
- Docker 部署:docker-compose + nginx

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 17:57:14 +08:00

72 lines
1.8 KiB
TypeScript

/**
* Component tests for KPIRadarChart.
* Validates rendering with KPI scorecard data.
*/
import { describe, it, expect } from 'vitest';
import { mount } from '@vue/test-utils';
import KPIRadarChart from '@/components/charts/KPIRadarChart.vue';
const mockScorecard = {
sprintDeliveryRate: 82,
avgDeliveryDays: 4.5,
bugDensity: 0.08,
prMergeTimeAvg: 24,
reviewParticipation: 75,
activityStreak: 12,
};
describe('KPIRadarChart', () => {
it('should mount with scorecard data', () => {
const wrapper = mount(KPIRadarChart, {
props: { scorecard: mockScorecard },
});
expect(wrapper.exists()).toBe(true);
});
it('should have chart container', () => {
const wrapper = mount(KPIRadarChart, {
props: { scorecard: mockScorecard },
});
expect(wrapper.find('.kpi-radar-chart').exists()).toBe(true);
});
it('should handle null scorecard', () => {
const wrapper = mount(KPIRadarChart, {
props: { scorecard: null },
});
expect(wrapper.exists()).toBe(true);
});
it('should handle extreme values', () => {
const wrapper = mount(KPIRadarChart, {
props: {
scorecard: {
sprintDeliveryRate: 100,
avgDeliveryDays: 0,
bugDensity: 0,
prMergeTimeAvg: 0,
reviewParticipation: 100,
activityStreak: 365,
},
},
});
expect(wrapper.exists()).toBe(true);
});
it('should handle all-zero values', () => {
const wrapper = mount(KPIRadarChart, {
props: {
scorecard: {
sprintDeliveryRate: 0,
avgDeliveryDays: 0,
bugDensity: 0,
prMergeTimeAvg: 0,
reviewParticipation: 0,
activityStreak: 0,
},
},
});
expect(wrapper.exists()).toBe(true);
});
});