Plan: Fix sidebar org/env views — add test infrastructure and unit tests#
Summary#
The code fix for buildOrgViewItems and buildEnvViewItems is already merged (commit 1b54b4b). The remaining work is setting up Vitest test infrastructure and writing unit tests that cover multi-issue scanning, deduplication, run merging, and empty-state edge cases per the acceptance criteria.
Files#
| File | Action | Description |
|---|---|---|
package.json | modify | Add vitest, @testing-library deps; update test script |
vitest.config.ts | create | Vitest configuration for Next.js/TypeScript project |
tsconfig.json | modify | Add vitest type references if needed |
src/lib/utils/__tests__/sidebar.test.ts | create | Unit tests for buildOrgViewItems, buildEnvViewItems, findNodeAtPath |
Steps#
- Install Vitest and configure it for the Next.js/TypeScript project — create
vitest.config.ts, updatepackage.jsontest script. - Write unit tests for
buildOrgViewItemscovering: multi-issue scanning, org deduplication by name, repo deduplication within an org, run merging across issues, empty root array, and missingtasks/e2e/inside an issue directory. - Write unit tests for
buildEnvViewItemscovering: multi-issue scanning, environment grouping (e2e,production), child merging across issues, empty root array, and missingtasks/inside an issue directory. - Write unit tests for
findNodeAtPathhelper covering: valid path lookup, missing intermediate segment, empty segments array.
Verification#
npm run testpasses with all new tests greennpm run lintpasses with zero warningsnpm run buildsucceeds without errors
Risks#
- No existing test infrastructure means Step 1 must correctly configure Vitest for Next.js path aliases (
@/→src/) — verifytsconfig.jsonpaths are resolved.