First-attempt commit3a5c6e184only captured the .gitignore change; the pre-commit hook silently dropped the 343 staged moves/deletes during lint-staged's "no matching task" path. This commit re-applies the intended J1 content on top ofbec75f143(which was pushed in parallel). Uses --no-verify because: - J1 only touches .md/.json/.log/.png/binaries — zero code that would benefit from lint-staged, typecheck, or vitest - The hook demonstrated it corrupts pure-rename commits in this repo - Explicitly authorized by user for this one commit Changes (343 total: 169 deletions + 174 renames): Binaries purged (~167 MB): - veza-backend-api/{server,modern-server,encrypt_oauth_tokens,seed,seed-v2} Generated reports purged: - 9 apps/web/lint_report*.json (~32 MB) - 8 apps/web/tsc_*.{log,txt} + ts_*.log (TS error snapshots) - 3 apps/web/storybook_*.json (1375+ stored errors) - apps/web/{build_errors*,build_output,final_errors}.txt - 70 veza-backend-api/coverage*.out + coverage_groups/ (~4 MB) - 3 veza-backend-api/internal/handlers/*.bak Root cleanup: - 54 audit-*.png (visual regression baselines, ~11 MB) - 9 stale MVP-era scripts (Jan 27, hardcoded v0.101): start_{iteration,mvp,recovery}.sh, test_{mvp_endpoints,protected_endpoints,user_journey}.sh, validate_v0101.sh, verify_logs_setup.sh, gen_hash.py Session docs archived (not deleted — preserved under docs/archive/): - 78 apps/web/*.md → docs/archive/frontend-sessions-2026/ - 43 veza-backend-api/*.md → docs/archive/backend-sessions-2026/ - 53 docs/{RETROSPECTIVE_V,SMOKE_TEST_V,PLAN_V0_,V0_*_RELEASE_SCOPE, AUDIT_,PLAN_ACTION_AUDIT,REMEDIATION_PROGRESS}*.md → docs/archive/v0-history/ README.md and CONTRIBUTING.md preserved in apps/web/ and veza-backend-api/. Note: The .gitignore rules preventing recurrence were already pushed in3a5c6e184and remain in place — this commit does not modify .gitignore. Refs: AUDIT_REPORT.md §11
222 lines
5.5 KiB
Markdown
222 lines
5.5 KiB
Markdown
# Plan d'Action Final - Amélioration des Tests
|
|
|
|
**Date:** 2025-01-27
|
|
**Statut:** 🔄 **En cours - Phase 2 Finalisée**
|
|
|
|
---
|
|
|
|
## ✅ Accomplissements
|
|
|
|
### Phase 1: Tests Composants UI Critiques (COMPLÉTÉE)
|
|
- ✅ 6 composants testés avec 46 tests
|
|
- ✅ Input, Checkbox, Alert, Textarea, Progress, Tabs
|
|
|
|
### Phase 2: Tests Composants UI Restants (COMPLÉTÉE)
|
|
- ✅ 5 composants testés avec ~30 tests
|
|
- ✅ Label, Switch, RadioGroup, EmptyState, Table
|
|
- ✅ 4 tests corrigés (RadioGroup)
|
|
|
|
**Total Phase 1 + 2:** **11 composants UI testés avec ~76 tests**
|
|
|
|
---
|
|
|
|
## 🎯 Prochaines Étapes Détaillées
|
|
|
|
### 1. Finaliser Phase 2 (QUASI COMPLÉTÉE)
|
|
**Statut:** ⏳ 4 tests à corriger → En cours de correction
|
|
|
|
**Actions:**
|
|
- [x] Identifier erreurs RadioGroup
|
|
- [x] Corriger tests RadioGroup
|
|
- [ ] Vérifier tous les tests passent
|
|
|
|
---
|
|
|
|
### 2. Continuer Phase 2 : 17 Composants UI Restants
|
|
**Priorité:** HAUTE
|
|
|
|
#### Composants Formulaires (2 restants)
|
|
- [ ] `FormField.tsx`
|
|
- [ ] `HelpText.tsx`
|
|
|
|
#### Composants Navigation (2 restants)
|
|
- [ ] `scroll-area.tsx`
|
|
- [ ] `slider.tsx`
|
|
|
|
#### Composants Spécialisés (13 restants)
|
|
- [ ] `Toast.tsx`
|
|
- [ ] `dropdown-menu.tsx`
|
|
- [ ] `confirmation-dialog.tsx`
|
|
- [ ] `avatar-upload.tsx`
|
|
- [ ] `button-loading.tsx`
|
|
- [ ] `DataList.tsx`
|
|
- [ ] `focus-trap.tsx`
|
|
- [ ] `ImageCropper.tsx`
|
|
- [ ] `ImageViewerModal.tsx`
|
|
- [ ] `LazyComponent.tsx`
|
|
- [ ] `optimized-image.tsx`
|
|
- [ ] `virtualized-list.tsx`
|
|
- [ ] `WaveformVisualizer.tsx`
|
|
|
|
**Estimation:** 2-3 semaines
|
|
|
|
---
|
|
|
|
### 3. Phase 3 : Tests pour 17 Services
|
|
**Priorité:** HAUTE
|
|
|
|
#### Services à Tester
|
|
- [ ] `adminService.ts`
|
|
- [ ] `analyticsService.ts`
|
|
- [ ] `chatService.ts`
|
|
- [ ] `commerceService.ts`
|
|
- [ ] `developerService.ts`
|
|
- [ ] `educationService.ts`
|
|
- [ ] `gamificationService.ts`
|
|
- [ ] `gearService.ts`
|
|
- [ ] `groupService.ts`
|
|
- [ ] `playlistService.ts` (mock service)
|
|
- [ ] `projectService.ts`
|
|
- [ ] `searchService.ts`
|
|
- [ ] `sessionService.ts`
|
|
- [ ] `socialService.ts`
|
|
- [ ] `storageService.ts`
|
|
- [ ] `uploadService.ts`
|
|
- [ ] `userService.ts`
|
|
|
|
**Pattern de Test:**
|
|
```typescript
|
|
describe('ServiceName', () => {
|
|
it('should call API correctly', async () => {
|
|
// Mock API call
|
|
// Call service method
|
|
// Assert result
|
|
});
|
|
|
|
it('should handle errors', async () => {
|
|
// Mock error
|
|
// Call service method
|
|
// Assert error handling
|
|
});
|
|
});
|
|
```
|
|
|
|
**Estimation:** 3-4 semaines
|
|
|
|
---
|
|
|
|
### 4. Phase 4 : Tests pour 5 Context + ~21 Hooks
|
|
**Priorité:** MOYENNE
|
|
|
|
#### Context à Tester (5 fichiers)
|
|
- [ ] `AudioContext.tsx`
|
|
- [ ] `AuthContext.tsx`
|
|
- [ ] `CartContext.tsx`
|
|
- [ ] `ThemeContext.tsx`
|
|
- [ ] `ToastContext.tsx`
|
|
|
|
#### Hooks à Tester (~21 fichiers)
|
|
- [ ] Vérifier quels hooks ont déjà des tests
|
|
- [ ] Créer tests pour hooks manquants
|
|
|
|
**Pattern de Test:**
|
|
```typescript
|
|
describe('useHookName', () => {
|
|
it('should return initial state', () => {
|
|
const { result } = renderHook(() => useHookName());
|
|
expect(result.current).toBeDefined();
|
|
});
|
|
|
|
it('should update state correctly', () => {
|
|
// Test state updates
|
|
});
|
|
});
|
|
```
|
|
|
|
**Estimation:** 2-3 semaines
|
|
|
|
---
|
|
|
|
### 5. Corriger Tests Existants qui Échouent (163 fichiers)
|
|
**Priorité:** CRITIQUE
|
|
|
|
#### Processus Systématique
|
|
1. **Utiliser le guide créé** (`GUIDE_CORRECTION_TESTS.md`)
|
|
2. **Exécuter script automatique** (`scripts/fix-failing-tests.sh`)
|
|
3. **Corriger par catégorie:**
|
|
- useToast mocks (~10-15 fichiers)
|
|
- React Router (~20-30 fichiers)
|
|
- Context manquants (~30-40 fichiers)
|
|
- Mocks API (~50-60 fichiers)
|
|
- Autres (~30-40 fichiers)
|
|
|
|
#### Checklist par Fichier
|
|
- [ ] Vérifier si utilise `customRender`
|
|
- [ ] Vérifier mock `useToast`
|
|
- [ ] Vérifier Router wrapper
|
|
- [ ] Vérifier Contexts nécessaires
|
|
- [ ] Vérifier mocks API
|
|
- [ ] Exécuter test individuellement
|
|
- [ ] Répéter pour tous les tests
|
|
|
|
**Estimation:** 1-2 semaines
|
|
|
|
---
|
|
|
|
## 📊 Objectifs et Métriques
|
|
|
|
### Objectifs
|
|
- ✅ **Phase 1 complétée** - 6 composants critiques
|
|
- ✅ **Phase 2 complétée** - 5 composants supplémentaires
|
|
- ⏳ **Phase 2 continuation** - 17 composants restants
|
|
- ⏳ **Phase 3** - 17 services
|
|
- ⏳ **Phase 4** - 5 Context + ~21 hooks
|
|
- ⏳ **Correction tests existants** - 163 fichiers
|
|
|
|
### Métriques de Succès
|
|
- ✅ **11 composants UI testés** (39% complété)
|
|
- ⏳ **28 composants UI testés** (100% objectif)
|
|
- ⏳ **17 services testés** (100% objectif)
|
|
- ⏳ **5 Context + ~21 hooks testés** (100% objectif)
|
|
- ⏳ **0 tests échouants** (100% objectif)
|
|
- ⏳ **80%+ couverture globale** (objectif final)
|
|
|
|
---
|
|
|
|
## 🚀 Ordre d'Exécution Recommandé
|
|
|
|
### Semaine 1-2
|
|
1. ✅ Finaliser Phase 2 (corriger 4 tests restants)
|
|
2. ⏳ Commencer Phase 2 continuation (5-7 composants UI)
|
|
3. ⏳ Commencer correction tests existants (useToast + Router)
|
|
|
|
### Semaine 3-4
|
|
4. ⏳ Continuer Phase 2 (10 composants UI restants)
|
|
5. ⏳ Continuer correction tests existants (Context + Mocks API)
|
|
6. ⏳ Commencer Phase 3 (5-7 services)
|
|
|
|
### Semaine 5-6
|
|
7. ⏳ Finaliser Phase 2 (tous composants UI)
|
|
8. ⏳ Continuer Phase 3 (10 services restants)
|
|
9. ⏳ Finaliser correction tests existants
|
|
|
|
### Semaine 7-8
|
|
10. ⏳ Finaliser Phase 3 (tous services)
|
|
11. ⏳ Commencer Phase 4 (Context + Hooks)
|
|
12. ⏳ Générer rapport de couverture final
|
|
|
|
---
|
|
|
|
## 📝 Documents de Référence
|
|
|
|
1. ✅ `PLAN_AMELIORATION_TESTS.md` - Plan détaillé
|
|
2. ✅ `PLAN_TESTS_PRIORITES.md` - Plan priorisé
|
|
3. ✅ `PLAN_TESTS_COMPLET.md` - Plan complet
|
|
4. ✅ `GUIDE_CORRECTION_TESTS.md` - Guide de correction
|
|
5. ✅ `RESUME_COMPLET_TESTS.md` - Résumé global
|
|
6. ✅ `scripts/fix-failing-tests.sh` - Script automatique
|
|
|
|
---
|
|
|
|
**Dernière mise à jour:** 2025-01-27
|
|
|