Skip to main content

audit-tests

Audit & fix unit tests for permission-gated components

Informations de source

Dépôt
trycompai/comp
Dernière activité de la source
27 avril 2026 à 13:56
Langue détectée de SKILL.md
anglais
Étoiles
2 035
Forks
433

Options d'installation

Le prompt qui vérifie d'abord la source est sélectionné par défaut. Vous pouvez passer à une commande directe ou télécharger une copie locale.

Vérifiez les fichiers source

Lisez SKILL.md et les fichiers associés affichés par SkillsMP avant de décider de l'installer.

Affichage de SKILL.md

SKILL.md
Instructions source · Aperçu en lecture seule
name
audit-tests
description
Audit & fix unit tests for permission-gated components
Check that unit tests exist and pass for permission-gated components. **Write missing tests immediately.** ## Infrastructure - **Framework**: Vitest with jsdom - **Component testing**: `@testing-library/react` + `@testing-library/jest-dom` - **Setup**: `apps/app/src/test-utils/setup.ts` - **Permission mocks**: `apps/app/src/test-utils/mocks/permissions.ts` - **Run**: `cd apps/app && bunx vitest run` ## Required Test Pattern Every component importing `usePermissions` MUST have tests covering: 1. **Admin (write) user**: mutation elements visible/enabled 2. **Auditor (read-only)**: mutation elements hidden/disabled 3. **Data always visible**: read-only content renders regardless of permissions Use `setMockPermissions`, `ADMIN_PERMISSIONS`, `AUDITOR_PERMISSIONS` from test utils. ## Process 1. Find components with `usePermissions` in `$ARGUMENTS` 2. Check for corresponding `.test.tsx` files 3. Write missing tests following the pattern above 4. Fix any failing tests 5. Run: `cd apps/app && bunx vitest run`
Voir sur GitHub