test(web-ui): cover api.ts request layer + consolidate split Jest roots (#774) - #881
Merged
Merged
Conversation
…ts (#774) Frontend test-trust hardening (P3.3): 1. api.ts contract test — src/__tests__/lib/api.contract.test.ts pins method+URL+params+body for the critical endpoints (workspace/tasks/events + the auth request interceptor) via an axios-stub adapter, so wrong-endpoint / renamed-param / reshaped-body drift fails here instead of passing green under the module mocks every other suite uses. 2. Orphaned e2e suite removed — web-ui/e2e (no CI job, fully mocked backend, drifted fixtures) and its web-ui/playwright.config.ts are deleted. The real-backend Playwright harness at tests/e2e/ (CI-wired: e2e-browser-smoke + e2e-browser-full, #684/#703) already covers these pages. Dropped the dead test:e2e* scripts and the now-transitive @playwright/test devDep. 3. Jest roots consolidated under src/__tests__ — the legacy web-ui/__tests__ root is gone. The 7 "duplicated" files were divergent, not redundant: 6 pairs test disjoint concerns (e.g. PRDHeader header-actions vs stress-test button; TaskCard full-card vs status-tooltip; PRStatusPanel merge-gate vs CI/SWR/review). Kept both copies under focus-suffixed names (X.navigation/.actions/.events/.checks/.tooltip.test), matching the repo's existing multi-file-per-component convention — no coverage dropped. Only AssociatedTasksSummary (src ⊇ root) collapsed to a single file. Suite: 95 → 95 suites, 1052 → 1065 tests, all green. Lint + build pass. Closes #774
Contributor
|
Claude finished @frankbria's task in 12m 35s —— View job GLM precision bug review — complete ✅Scoped to concrete defects only (logic errors, null/unhandled paths, security, data loss, race conditions, breaking contract changes, resource leaks). Style/architecture/naming/coverage are covered by the separate general review — not commented here.
✅ GLM review: no defects found. What I verified against the checked-out code:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #774 — Frontend contract test-trust (P3.3).
What & why
The 1225-line
src/lib/api.tsrequest layer is module-mocked in every other suite, so wrong-endpoint / renamed-param / reshaped-body drift passes green everywhere. Theweb-ui/e2ePlaywright suite was orphaned (no CI job, fully-mocked backend, drifted fixtures), and 7 test files were duplicated across two divergent Jest roots.Acceptance criteria
src/__tests__/lib/api.contract.test.tsswaps the shared client's adapter for a capturing stub (runs after axios applies the auth interceptor, URL building, and body serialization) and asserts method+URL+params+body forworkspaceApi,tasksApi,eventsApi, plus the Bearer-token request interceptor. Axios-stub over msw: msw was installed but unwired, and the repo already tests the interceptors off the axios instance — no new jsdom/polyfill infra.web-ui/e2ewired to CI against a real backend OR deleted → deleted (web-ui/e2e/+web-ui/playwright.config.ts+test:e2e*scripts + the now-transitive@playwright/testdevDep). The real-backend Playwright harness attests/e2e/is already CI-wired (e2e-browser-smoke+e2e-browser-full, [P6.8.5] Rewrite Playwright browser E2E suite against current Phase-3+ UI #684/feat(e2e): rewrite Playwright browser suite for Phase-3+ UI (#684) #703) and covers the same pages, so the mocked orphan was pure dead weight.src/__tests__— legacyweb-ui/__tests__root removed;jest.config.jsignore patterns updated (dropped the dead/e2e/ignore).Key decision: the 7 "duplicates" were divergent, not redundant
Picking one copy per pair by recency would have silently dropped half the coverage — the opposite of a test-trust fix. 6 of 7 pairs test disjoint concerns:
Both copies are kept under focus-suffixed names (
X.actions/.tooltip/.checks/.events/.navigation.test), matching the repo's existing multi-file-per-component convention (TaskBoardView.githubImport.test.tsx, …). OnlyAssociatedTasksSummary(src was a strict superset) collapsed to one file.Verification
npm test→ 95 suites, 1065 tests, all green (baseline 1052; +13 from the new contract test, −4 from the one redundant collapse).npm run lint→ clean ·npm run build→ succeeds.npm ci --dry-runresolves (lockfile in sync after the devDep removal;@playwright/testremains transitively vianext).Known limitations