Pins the behavioural invariants that landed in PR #5490 (the frontend half of the #5375-regression fix-up backlog) so a future hardening pass cannot quietly undo them. Today these surfaces have only typecheck + bundle-build coverage; this lifts the floor. What's pinned (35 tests across 3 files, ~360 ms): - src/lib/__tests__/format-fastapi-error.test.ts (17) formatFastApiDetail + readFastApiError: string passthrough, array detail joined as "field: msg" / "; ", nested loc joined by ".", missing msg / missing loc / empty array / mixed valid+junk, plus Response shapes for 422 / 400 / 500 / 503 / non-JSON / object-detail + message fallback. Regression target: rendering `[object Object]` or `Request failed (422)` instead of "field: msg". - src/features/auth/__tests__/session.test.ts (10) storeAuthTokens writes only the two JWT keys (never the must-change key -- the CodeQL data-flow pin); clearAuthTokens removes all three; setMustChangePassword writes the literal "1" / removes the key (presence-encoded so the stored value stays a constant, not a derived boolean); isOnboardingDone treats only the literal "true" as done. - src/features/auth/__tests__/api.test.ts (8) refreshSession singleflight (5 racing callers -> 1 /api/auth/refresh request); in-flight slot clears so subsequent calls refetch; non-OK response clears tokens; no refresh token -> no fetch; logoutGeneration drops the new token pair when logout() lands mid-refresh; logout() clears local state on 204; logout() retries with a rotated access token on 401; logout() still clears state on network failure. Wiring: - vitest 4 + happy-dom 18 as devDependencies. - vitest.config.ts mirrors the @/ alias from tsconfig.app.json. - New `test` / `test:watch` scripts. Workflow step (CI gating) is intentionally NOT included in this PR because the publishing token lacks `workflow` scope. After merge, add this between the Typecheck and Build steps in .github/workflows/studio-frontend-ci.yml: - name: Unit tests (Vitest) run: npm run test `npm run typecheck` / `test` / `build` all clean locally. |
||
|---|---|---|
| .. | ||
| public | ||
| src | ||
| .gitignore | ||
| .gitkeep | ||
| .npmrc | ||
| biome.json | ||
| components.json | ||
| data-designer.openapi (1).yaml | ||
| eslint.config.js | ||
| index.html | ||
| package-lock.json | ||
| package.json | ||
| tsconfig.app.json | ||
| tsconfig.json | ||
| tsconfig.node.json | ||
| vite.config.ts | ||
| vitest.config.ts | ||