Add test coverage analysis with prioritized improvement proposals#24
Add test coverage analysis with prioritized improvement proposals#24blackboxprogramming wants to merge 4 commits intomainfrom
Conversation
Audited all source modules across the monorepo (API, UI library, Homework portal, RoadBook) and documented that no tests, test frameworks, or CI test execution currently exist. Proposed a prioritized testing strategy covering API integration tests, UI component unit tests, page-level tests, and E2E tests, along with infrastructure recommendations for Vitest, Testing Library, and CI integration. https://claude.ai/code/session_01GnR9K55guhFXRWEkvL93XN
There was a problem hiding this comment.
Pull request overview
This PR adds comprehensive test coverage analysis documentation for the BlackRoad monorepo. The document audits all modules (API, UI library, Homework portal, and RoadBook) and confirms the absence of any test infrastructure. It proposes a prioritized testing strategy with detailed test case recommendations and infrastructure setup instructions.
Changes:
- Added TEST_COVERAGE_ANALYSIS.md documenting current 0% test coverage across all modules
- Documented prioritized testing strategy covering API, UI components, page-level tests, and E2E tests
- Provided infrastructure recommendations for Vitest, Testing Library, supertest, MSW, and Playwright with CI integration steps
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| **Why:** The API layer (`apps/api/index.js` and `server_full.js`) is the highest-risk code. It handles user input, manages in-memory state, and bridges to external services. Bugs here affect every consumer. | ||
|
|
||
| **Recommended framework:** [Vitest](https://vitest.dev/) + [supertest](https://github.com/ladakh/supertest) for HTTP assertions. |
There was a problem hiding this comment.
The supertest repository URL is incorrect. The correct URL is https://github.com/visionmedia/supertest (or https://github.com/ladjs/supertest for the newer maintained fork), not https://github.com/ladakh/supertest which does not exist.
| **Recommended framework:** [Vitest](https://vitest.dev/) + [supertest](https://github.com/ladakh/supertest) for HTTP assertions. | |
| **Recommended framework:** [Vitest](https://vitest.dev/) + [supertest](https://github.com/visionmedia/supertest) for HTTP assertions. |
| | API server | `apps/api/index.js` | JS | 49 | 0 | 0% | | ||
| | Standalone server | `server_full.js` | JS | 44 | 0 | 0% | | ||
| | Homework portal | `apps/homework/pages/index.tsx` | TSX | 63 | 0 | 0% | | ||
| | RoadBook site | `apps/roadbook/pages/*.tsx` | TSX | ~135 | 0 | 0% | | ||
| | UI: Button | `packages/ui/src/components/Button.tsx` | TSX | 76 | 0 | 0% | | ||
| | UI: Input | `packages/ui/src/components/Input.tsx` | TSX | 53 | 0 | 0% | | ||
| | UI: Tabs | `packages/ui/src/components/Tabs.tsx` | TSX | 60 | 0 | 0% | | ||
| | UI: Badge | `packages/ui/src/components/Badge.tsx` | TSX | 61 | 0 | 0% | | ||
| | UI: Card | `packages/ui/src/components/Card.tsx` | TSX | 37 | 0 | 0% | | ||
| | UI: Dialog | `packages/ui/src/components/Dialog.tsx` | TSX | 85 | 0 | 0% | | ||
| | UI: Drawer | `packages/ui/src/components/Drawer.tsx` | TSX | 93 | 0 | 0% | | ||
| | UI: DataTable | `packages/ui/src/components/DataTable.tsx` | TSX | 92 | 0 | 0% | | ||
| | UI: Toast | `packages/ui/src/components/Toast.tsx` | TSX | 78 | 0 | 0% | |
There was a problem hiding this comment.
The line counts in the inventory table are consistently off by 1 for all files. For example, apps/api/index.js is listed as 49 lines but is actually 50 lines. This pattern repeats for all entries. Please verify and correct the line counts using the actual file sizes.
| | API server | `apps/api/index.js` | JS | 49 | 0 | 0% | | |
| | Standalone server | `server_full.js` | JS | 44 | 0 | 0% | | |
| | Homework portal | `apps/homework/pages/index.tsx` | TSX | 63 | 0 | 0% | | |
| | RoadBook site | `apps/roadbook/pages/*.tsx` | TSX | ~135 | 0 | 0% | | |
| | UI: Button | `packages/ui/src/components/Button.tsx` | TSX | 76 | 0 | 0% | | |
| | UI: Input | `packages/ui/src/components/Input.tsx` | TSX | 53 | 0 | 0% | | |
| | UI: Tabs | `packages/ui/src/components/Tabs.tsx` | TSX | 60 | 0 | 0% | | |
| | UI: Badge | `packages/ui/src/components/Badge.tsx` | TSX | 61 | 0 | 0% | | |
| | UI: Card | `packages/ui/src/components/Card.tsx` | TSX | 37 | 0 | 0% | | |
| | UI: Dialog | `packages/ui/src/components/Dialog.tsx` | TSX | 85 | 0 | 0% | | |
| | UI: Drawer | `packages/ui/src/components/Drawer.tsx` | TSX | 93 | 0 | 0% | | |
| | UI: DataTable | `packages/ui/src/components/DataTable.tsx` | TSX | 92 | 0 | 0% | | |
| | UI: Toast | `packages/ui/src/components/Toast.tsx` | TSX | 78 | 0 | 0% | | |
| | API server | `apps/api/index.js` | JS | 50 | 0 | 0% | | |
| | Standalone server | `server_full.js` | JS | 45 | 0 | 0% | | |
| | Homework portal | `apps/homework/pages/index.tsx` | TSX | 64 | 0 | 0% | | |
| | RoadBook site | `apps/roadbook/pages/*.tsx` | TSX | ~136 | 0 | 0% | | |
| | UI: Button | `packages/ui/src/components/Button.tsx` | TSX | 77 | 0 | 0% | | |
| | UI: Input | `packages/ui/src/components/Input.tsx` | TSX | 54 | 0 | 0% | | |
| | UI: Tabs | `packages/ui/src/components/Tabs.tsx` | TSX | 61 | 0 | 0% | | |
| | UI: Badge | `packages/ui/src/components/Badge.tsx` | TSX | 62 | 0 | 0% | | |
| | UI: Card | `packages/ui/src/components/Card.tsx` | TSX | 38 | 0 | 0% | | |
| | UI: Dialog | `packages/ui/src/components/Dialog.tsx` | TSX | 86 | 0 | 0% | | |
| | UI: Drawer | `packages/ui/src/components/Drawer.tsx` | TSX | 94 | 0 | 0% | | |
| | UI: DataTable | `packages/ui/src/components/DataTable.tsx` | TSX | 93 | 0 | 0% | | |
| | UI: Toast | `packages/ui/src/components/Toast.tsx` | TSX | 79 | 0 | 0% | |
Set up Vitest across the monorepo with testing-library/react for component tests and supertest for API integration tests. - API (12 tests): health endpoint, CORS middleware, homework CRUD with validation and error cases - UI (95 tests): Button, Input, Tabs, Badge, Card, Dialog, Drawer, DataTable, Toast — covering variants, sizes, interactivity, accessibility attributes, and edge cases - Refactored apps/api/index.js to export app for testability - Updated CI pipeline to run tests on PR/push https://claude.ai/code/session_01GnR9K55guhFXRWEkvL93XN
New endpoints: - GET /api/homework/:id — fetch a single item (404 if not found) - PUT /api/homework/:id — update title, description, completed - DELETE /api/homework/:id — remove an item and return it Enhancements to existing endpoints: - GET /api/homework now supports ?search= query param for case-insensitive filtering across title and description - POST /api/homework now returns completed (false) and createdAt - CORS allows PUT and DELETE methods - IDs are now sequential integers instead of Date.now() Test suite expanded from 12 to 34 tests covering all new endpoints, validation errors, 404 handling, search filtering, and state persistence across operations. https://claude.ai/code/session_01GnR9K55guhFXRWEkvL93XN
server_full.js (10 tests): - GET /api/hello and GET /health endpoint verification - POST /api/llm/chat input validation (missing, non-string, whitespace, null body) - Successful upstream forwarding with mocked fetch - Fallback when upstream reply field is absent - 502 on unreachable upstream and invalid JSON responses Design tokens (33 tests): - JSON structure validation - All 8 required semantic colors exist and are valid hex - Font families (sans, mono), sizes (ascending order), weights - Border radii (all keys present, ascending order, edge values) Refactored server_full.js to export app for testability via require.main guard. Updated CI to run root-level tests. https://claude.ai/code/session_01GnR9K55guhFXRWEkvL93XN
Audited all source modules across the monorepo (API, UI library,
Homework portal, RoadBook) and documented that no tests, test
frameworks, or CI test execution currently exist. Proposed a
prioritized testing strategy covering API integration tests, UI
component unit tests, page-level tests, and E2E tests, along with
infrastructure recommendations for Vitest, Testing Library, and CI
integration.
https://claude.ai/code/session_01GnR9K55guhFXRWEkvL93XN