197 lines
5.8 KiB
Markdown
197 lines
5.8 KiB
Markdown
# Plan d'Amélioration de la Couverture de Tests
|
|
|
|
**Date:** 2025-01-27
|
|
**Objectif:** Atteindre 80%+ de couverture de tests
|
|
|
|
---
|
|
|
|
## 📊 État Actuel
|
|
|
|
### Tests Existants
|
|
- ✅ **73 fichiers** `.test.ts` (tests unitaires)
|
|
- ✅ **170 fichiers** `.test.tsx` (tests composants)
|
|
- ✅ **18 fichiers** `.spec.ts` (tests E2E Playwright)
|
|
- ✅ Vitest configuré avec seuil de 80%
|
|
- ✅ Playwright configuré pour tests E2E
|
|
|
|
### Composants UI avec Tests
|
|
- ✅ `avatar.test.tsx`
|
|
- ✅ `badge.test.tsx`
|
|
- ✅ `button.test.tsx`
|
|
- ✅ `card.test.tsx`
|
|
- ✅ `dialog.test.tsx`
|
|
- ✅ `dropdown.test.tsx`
|
|
- ✅ `file-upload.test.tsx`
|
|
- ✅ `loading-spinner.test.tsx`
|
|
- ✅ `modal.test.tsx`
|
|
- ✅ `select.test.tsx`
|
|
- ✅ `skeleton.test.tsx`
|
|
- ✅ `tooltip.test.tsx`
|
|
- ✅ `date-picker.test.tsx`
|
|
|
|
### Composants UI SANS Tests (à créer)
|
|
- ❌ `alert.tsx`
|
|
- ❌ `avatar-upload.tsx`
|
|
- ❌ `button-loading.tsx`
|
|
- ❌ `checkbox.tsx`
|
|
- ❌ `confirmation-dialog.tsx`
|
|
- ❌ `DataList.tsx`
|
|
- ❌ `dropdown-menu.tsx`
|
|
- ❌ `empty-state.tsx`
|
|
- ❌ `focus-trap.tsx`
|
|
- ❌ `FormField.tsx`
|
|
- ❌ `HelpText.tsx`
|
|
- ❌ `ImageCropper.tsx`
|
|
- ❌ `ImageViewerModal.tsx`
|
|
- ❌ `input.tsx`
|
|
- ❌ `label.tsx`
|
|
- ❌ `LazyComponent.tsx`
|
|
- ❌ `optimized-image.tsx`
|
|
- ❌ `progress.tsx`
|
|
- ❌ `radio-group.tsx`
|
|
- ❌ `scroll-area.tsx`
|
|
- ❌ `slider.tsx`
|
|
- ❌ `switch.tsx`
|
|
- ❌ `table.tsx`
|
|
- ❌ `tabs.tsx`
|
|
- ❌ `textarea.tsx`
|
|
- ❌ `Toast.tsx`
|
|
- ❌ `virtualized-list.tsx`
|
|
- ❌ `WaveformVisualizer.tsx`
|
|
|
|
**Total:** ~28 composants UI sans tests
|
|
|
|
---
|
|
|
|
## 🎯 Plan d'Action
|
|
|
|
### Phase 1: Tests Composants UI Critiques (Priorité Haute)
|
|
**Objectif:** Couvrir les composants UI les plus utilisés
|
|
|
|
#### Semaine 1-2
|
|
- [ ] `input.tsx` - Composant critique, utilisé partout
|
|
- [ ] `checkbox.tsx` - Composant critique
|
|
- [ ] `textarea.tsx` - Composant critique
|
|
- [ ] `progress.tsx` - Composant critique
|
|
- [ ] `alert.tsx` - Composant critique pour feedback
|
|
- [ ] `tabs.tsx` - Composant critique pour navigation
|
|
- [ ] `switch.tsx` - Composant critique pour settings
|
|
|
|
#### Semaine 3-4
|
|
- [ ] `table.tsx` - Composant critique pour données
|
|
- [ ] `radio-group.tsx` - Composant critique
|
|
- [ ] `slider.tsx` - Composant critique
|
|
- [ ] `empty-state.tsx` - Composant critique pour UX
|
|
- [ ] `label.tsx` - Composant critique pour formulaires
|
|
- [ ] `scroll-area.tsx` - Composant critique
|
|
|
|
### Phase 2: Tests Composants UI Avancés (Priorité Moyenne)
|
|
**Objectif:** Couvrir les composants UI spécialisés
|
|
|
|
#### Semaine 5-6
|
|
- [ ] `ImageCropper.tsx` - Composant spécialisé
|
|
- [ ] `avatar-upload.tsx` - Composant spécialisé
|
|
- [ ] `confirmation-dialog.tsx` - Composant spécialisé
|
|
- [ ] `dropdown-menu.tsx` - Composant spécialisé
|
|
- [ ] `Toast.tsx` - Composant spécialisé
|
|
- [ ] `ImageViewerModal.tsx` - Composant spécialisé
|
|
|
|
#### Semaine 7-8
|
|
- [ ] `WaveformVisualizer.tsx` - Composant spécialisé audio
|
|
- [ ] `virtualized-list.tsx` - Composant spécialisé performance
|
|
- [ ] `optimized-image.tsx` - Composant spécialisé performance
|
|
- [ ] `LazyComponent.tsx` - Composant spécialisé performance
|
|
- [ ] `FormField.tsx` - Composant spécialisé formulaires
|
|
- [ ] `HelpText.tsx` - Composant spécialisé formulaires
|
|
- [ ] `DataList.tsx` - Composant spécialisé données
|
|
- [ ] `focus-trap.tsx` - Composant spécialisé accessibilité
|
|
- [ ] `button-loading.tsx` - Composant spécialisé UX
|
|
|
|
### Phase 3: Tests Services & Utilitaires (Priorité Haute)
|
|
**Objectif:** Couvrir la logique métier
|
|
|
|
#### Services à Tester (20 fichiers)
|
|
- [ ] `adminService.ts` - Tests manquants
|
|
- [ ] `analyticsService.ts` - Tests manquants
|
|
- [ ] `chatService.ts` - Tests manquants
|
|
- [ ] `commerceService.ts` - Tests manquants
|
|
- [ ] `developerService.ts` - Tests manquants
|
|
- [ ] `educationService.ts` - Tests manquants
|
|
- [ ] `gamificationService.ts` - Tests manquants
|
|
- [ ] `gearService.ts` - Tests manquants
|
|
- [ ] `groupService.ts` - Tests manquants
|
|
- [ ] `marketplaceService.ts` - ✅ Déjà testé
|
|
- [ ] `playlistService.ts` - Tests manquants
|
|
- [ ] `projectService.ts` - Tests manquants
|
|
- [ ] `searchService.ts` - Tests manquants
|
|
- [ ] `sessionService.ts` - Tests manquants
|
|
- [ ] `socialService.ts` - Tests manquants
|
|
- [ ] `storageService.ts` - Tests manquants
|
|
- [ ] `uploadService.ts` - Tests manquants
|
|
- [ ] `userService.ts` - Tests manquants
|
|
|
|
### Phase 4: Tests Context & Hooks (Priorité Moyenne)
|
|
**Objectif:** Couvrir la gestion d'état
|
|
|
|
#### Context à Tester (5 fichiers)
|
|
- [ ] `AudioContext.tsx` - Tests manquants
|
|
- [ ] `AuthContext.tsx` - Tests manquants
|
|
- [ ] `CartContext.tsx` - Tests manquants
|
|
- [ ] `ThemeContext.tsx` - Tests manquants
|
|
- [ ] `ToastContext.tsx` - Tests manquants
|
|
|
|
#### Hooks à Tester (~21 fichiers)
|
|
- [ ] Vérifier quels hooks ont déjà des tests
|
|
- [ ] Créer tests pour hooks manquants
|
|
|
|
### Phase 5: Tests Composants Views (Priorité Basse)
|
|
**Objectif:** Couvrir les vues principales
|
|
|
|
#### Views à Tester (~21 fichiers)
|
|
- [ ] `AdminView.tsx`
|
|
- [ ] `AnalyticsView.tsx`
|
|
- [ ] `AuthView.tsx`
|
|
- [ ] `ChatView.tsx`
|
|
- [ ] `EducationView.tsx`
|
|
- [ ] `FileDetailsView.tsx`
|
|
- [ ] `FileManagerView.tsx`
|
|
- [ ] `GearView.tsx`
|
|
- [ ] `LiveView.tsx`
|
|
- [ ] `MarketplaceView.tsx`
|
|
- [ ] `NotificationsView.tsx`
|
|
- [ ] `ProfileView.tsx`
|
|
- [ ] `PurchasesView.tsx`
|
|
- [ ] `SearchPageView.tsx`
|
|
- [ ] `SettingsView.tsx`
|
|
- [ ] `SocialView.tsx`
|
|
- [ ] `UploadView.tsx`
|
|
|
|
---
|
|
|
|
## 📈 Métriques de Succès
|
|
|
|
### Objectifs
|
|
- ✅ **80%+ couverture globale**
|
|
- ✅ **90%+ couverture pour composants UI critiques**
|
|
- ✅ **80%+ couverture pour services**
|
|
- ✅ **70%+ couverture pour views**
|
|
|
|
### Outils
|
|
- Vitest avec `@vitest/coverage-v8`
|
|
- Playwright pour tests E2E
|
|
- MSW pour mocks API
|
|
|
|
---
|
|
|
|
## 🚀 Prochaines Étapes Immédiates
|
|
|
|
1. ✅ Installer `@vitest/coverage-v8`
|
|
2. ⏳ Générer rapport de couverture actuel
|
|
3. ⏳ Identifier zones critiques avec faible couverture
|
|
4. ⏳ Créer tests pour composants UI critiques en priorité
|
|
5. ⏳ Créer tests pour services manquants
|
|
|
|
---
|
|
|
|
**Dernière mise à jour:** 2025-01-27
|
|
|