- 后端: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>
62 lines
1.6 KiB
TypeScript
62 lines
1.6 KiB
TypeScript
/**
|
|
* Component tests for WeeklyCodeActivity.
|
|
* Validates rendering with stacked area chart data.
|
|
*/
|
|
import { describe, it, expect } from 'vitest';
|
|
import { mount } from '@vue/test-utils';
|
|
import WeeklyCodeActivity from '@/components/charts/WeeklyCodeActivity.vue';
|
|
|
|
const mockWeeks = [
|
|
{
|
|
weekStart: '2026-03-02',
|
|
members: [
|
|
{ userId: 'u1', name: 'Alice', commits: 12, prs: 3 },
|
|
{ userId: 'u2', name: 'Bob', commits: 8, prs: 2 },
|
|
],
|
|
},
|
|
{
|
|
weekStart: '2026-03-09',
|
|
members: [
|
|
{ userId: 'u1', name: 'Alice', commits: 15, prs: 4 },
|
|
{ userId: 'u2', name: 'Bob', commits: 10, prs: 1 },
|
|
],
|
|
},
|
|
];
|
|
|
|
describe('WeeklyCodeActivity', () => {
|
|
it('should mount with weeks data', () => {
|
|
const wrapper = mount(WeeklyCodeActivity, {
|
|
props: { weeks: mockWeeks },
|
|
});
|
|
expect(wrapper.exists()).toBe(true);
|
|
});
|
|
|
|
it('should have chart container', () => {
|
|
const wrapper = mount(WeeklyCodeActivity, {
|
|
props: { weeks: mockWeeks },
|
|
});
|
|
expect(wrapper.find('.weekly-code-activity').exists()).toBe(true);
|
|
});
|
|
|
|
it('should handle empty weeks', () => {
|
|
const wrapper = mount(WeeklyCodeActivity, {
|
|
props: { weeks: [] },
|
|
});
|
|
expect(wrapper.exists()).toBe(true);
|
|
});
|
|
|
|
it('should handle single member', () => {
|
|
const wrapper = mount(WeeklyCodeActivity, {
|
|
props: {
|
|
weeks: [
|
|
{
|
|
weekStart: '2026-03-02',
|
|
members: [{ userId: 'u1', name: 'Solo', commits: 5, prs: 1 }],
|
|
},
|
|
],
|
|
},
|
|
});
|
|
expect(wrapper.exists()).toBe(true);
|
|
});
|
|
});
|