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
5.5 KiB
5.5 KiB
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:
- Identifier erreurs RadioGroup
- Corriger tests RadioGroup
- Vérifier tous les tests passent
2. Continuer Phase 2 : 17 Composants UI Restants
Priorité: HAUTE
Composants Formulaires (2 restants)
FormField.tsxHelpText.tsx
Composants Navigation (2 restants)
scroll-area.tsxslider.tsx
Composants Spécialisés (13 restants)
Toast.tsxdropdown-menu.tsxconfirmation-dialog.tsxavatar-upload.tsxbutton-loading.tsxDataList.tsxfocus-trap.tsxImageCropper.tsxImageViewerModal.tsxLazyComponent.tsxoptimized-image.tsxvirtualized-list.tsxWaveformVisualizer.tsx
Estimation: 2-3 semaines
3. Phase 3 : Tests pour 17 Services
Priorité: HAUTE
Services à Tester
adminService.tsanalyticsService.tschatService.tscommerceService.tsdeveloperService.tseducationService.tsgamificationService.tsgearService.tsgroupService.tsplaylistService.ts(mock service)projectService.tssearchService.tssessionService.tssocialService.tsstorageService.tsuploadService.tsuserService.ts
Pattern de Test:
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.tsxAuthContext.tsxCartContext.tsxThemeContext.tsxToastContext.tsx
Hooks à Tester (~21 fichiers)
- Vérifier quels hooks ont déjà des tests
- Créer tests pour hooks manquants
Pattern de Test:
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
- Utiliser le guide créé (
GUIDE_CORRECTION_TESTS.md) - Exécuter script automatique (
scripts/fix-failing-tests.sh) - 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
- ✅ Finaliser Phase 2 (corriger 4 tests restants)
- ⏳ Commencer Phase 2 continuation (5-7 composants UI)
- ⏳ Commencer correction tests existants (useToast + Router)
Semaine 3-4
- ⏳ Continuer Phase 2 (10 composants UI restants)
- ⏳ Continuer correction tests existants (Context + Mocks API)
- ⏳ Commencer Phase 3 (5-7 services)
Semaine 5-6
- ⏳ Finaliser Phase 2 (tous composants UI)
- ⏳ Continuer Phase 3 (10 services restants)
- ⏳ Finaliser correction tests existants
Semaine 7-8
- ⏳ Finaliser Phase 3 (tous services)
- ⏳ Commencer Phase 4 (Context + Hooks)
- ⏳ Générer rapport de couverture final
📝 Documents de Référence
- ✅
PLAN_AMELIORATION_TESTS.md- Plan détaillé - ✅
PLAN_TESTS_PRIORITES.md- Plan priorisé - ✅
PLAN_TESTS_COMPLET.md- Plan complet - ✅
GUIDE_CORRECTION_TESTS.md- Guide de correction - ✅
RESUME_COMPLET_TESTS.md- Résumé global - ✅
scripts/fix-failing-tests.sh- Script automatique
Dernière mise à jour: 2025-01-27