/** * 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); }); });