Refactor GitLab Duo and SDLC trends mock data to use fixtures
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Summary
Currently, the GitLab Duo and SDLC trends analytics tests use manually maintained mock data objects. We should refactor these to use fixtures for better maintainability and consistency.
Context
Related to !207924 (comment 2812305767)
The current approach requires manually updating mock data in multiple places:
ee/spec/frontend/analytics/dashboards/ai_impact/mock_data.jsee/spec/frontend/analytics/dashboards/ai_impact/helpers.js
This creates maintenance overhead and potential for inconsistencies.
Proposal
Refactor the mock data generation to use fixtures instead:
- Create fixture files for AI metrics responses
- Update test helpers to load data from fixtures
- Ensure fixtures cover all test scenarios (zero values, null values, full data)
- Update existing tests to use fixture-based mock data
Benefits
- Single source of truth: Fixtures can be shared across tests
- Easier maintenance: Update data in one place
- Better consistency: Reduces risk of test data drift
- Improved readability: Tests focus on behavior, not data setup
Edited by 🤖 GitLab Bot 🤖