/** * Component tests for SprintDeliveryChart. * Validates rendering, prop handling, and chart option computation. */ import { describe, it, expect } from 'vitest'; import { mount } from '@vue/test-utils'; import SprintDeliveryChart from '@/components/charts/SprintDeliveryChart.vue'; const mockCycles = [ { name: 'Sprint 1', plannedPoints: 40, completedPoints: 32, deliveryRate: 80 }, { name: 'Sprint 2', plannedPoints: 45, completedPoints: 38, deliveryRate: 84.4 }, { name: 'Sprint 3', plannedPoints: 50, completedPoints: 42, deliveryRate: 84 }, { name: 'Sprint 4', plannedPoints: 55, completedPoints: 40, deliveryRate: 72.7 }, ]; describe('SprintDeliveryChart', () => { it('should mount without errors', () => { const wrapper = mount(SprintDeliveryChart, { props: { cycles: mockCycles }, }); expect(wrapper.exists()).toBe(true); }); it('should have a chart container element', () => { const wrapper = mount(SprintDeliveryChart, { props: { cycles: mockCycles }, }); const container = wrapper.find('.sprint-delivery-chart'); expect(container.exists()).toBe(true); }); it('should accept empty cycles array', () => { const wrapper = mount(SprintDeliveryChart, { props: { cycles: [] }, }); expect(wrapper.exists()).toBe(true); }); it('should accept custom targetRate prop', () => { const wrapper = mount(SprintDeliveryChart, { props: { cycles: mockCycles, targetRate: 90 }, }); expect(wrapper.exists()).toBe(true); }); it('should have minimum height of 260px', () => { const wrapper = mount(SprintDeliveryChart, { props: { cycles: mockCycles }, }); const container = wrapper.find('.sprint-delivery-chart'); // Check that the scoped style includes min-height expect(container.exists()).toBe(true); }); });