Summary
The frontend currently has only 1 unit test file (src/__tests__/rbac-permissions.test.tsx) covering permission helpers. The rest of the frontend — hooks, stores, API services, and utility functions — has zero unit test coverage.
Current State
- Vitest configured with jsdom environment and
@testing-library/jest-dom
- 1 test file:
rbac-permissions.test.tsx (~460 lines)
- Frontend tests are NOT run in CI (jsdom not installed in CI environment)
- Playwright E2E covers UI behavior (
functional.spec.ts, 1340 lines) but is slow and not granular
- ~32 custom hooks, 3 Zustand stores, 23 API service files — all untested
Priority Test Targets
- Zustand stores (
authStore, themeStore, backupDownloadStore) — state transitions, persistence, side effects
- Custom hooks (
useServer, useServers, useNodes, useFileManager, useSseConsole) — query key usage, refetch intervals, error handling
- API client (
services/api/client.ts) — 401 interceptor, CSRF handling, error reporting
- Utility functions — query key factory (
queryKeys.ts), validators
- Plugin system (
plugins/PluginProvider.tsx, plugins/loader.ts) — manifest loading, dynamic imports
Acceptance Criteria
Summary
The frontend currently has only 1 unit test file (
src/__tests__/rbac-permissions.test.tsx) covering permission helpers. The rest of the frontend — hooks, stores, API services, and utility functions — has zero unit test coverage.Current State
@testing-library/jest-domrbac-permissions.test.tsx(~460 lines)functional.spec.ts, 1340 lines) but is slow and not granularPriority Test Targets
authStore,themeStore,backupDownloadStore) — state transitions, persistence, side effectsuseServer,useServers,useNodes,useFileManager,useSseConsole) — query key usage, refetch intervals, error handlingservices/api/client.ts) — 401 interceptor, CSRF handling, error reportingqueryKeys.ts), validatorsplugins/PluginProvider.tsx,plugins/loader.ts) — manifest loading, dynamic importsAcceptance Criteria