Skip to content

test: Add test coverage for untested core files #25

@nigel-dev

Description

@nigel-dev

Description

Five core source files have zero test coverage. These files handle slash commands, tool registration, data directories, status reporting, and the dashboard — all user-facing functionality.

Untested Files

File Lines Responsibility Risk
`src/commands.ts` ~170 All slash command registration and dispatch Medium — user-facing
`src/tools/overview.ts` ~200 `mc_overview` dashboard aggregation Medium — primary status tool
`src/tools/report.ts` ~69 `mc_report` agent status reporting High — agent communication
`src/lib/paths.ts` ~30 Data directory resolution Low — simple but foundational
`src/lib/orchestrator-singleton.ts` ~40 Shared orchestrator/monitor instances Medium — state management

Proposed Approach

`commands.ts` (good starting point)

  • Test that each slash command dispatches to the correct tool
  • Test argument parsing (e.g., `/mc-status jobname` extracts `jobname`)
  • Test error handling for missing arguments

`overview.ts`

  • Test dashboard output format with various job states
  • Test with no jobs, running jobs, failed jobs, active plan
  • Test suggested actions logic

`report.ts`

  • Test `isInManagedWorktree` detection
  • Test report writing with various statuses
  • Test error when called from non-managed worktree

`paths.ts`

  • Test data directory resolution
  • Test project identification

`orchestrator-singleton.ts`

  • Test singleton pattern (same instance returned)
  • Test set/get for orchestrator and monitor

How to Verify

```bash
bun test
```

All new tests should follow existing patterns in `tests/` — see `tests/tools/cleanup.test.ts` or `tests/hooks/notifications.test.ts` for good examples of the mocking style used.

Additional Context

From audit report Section 7 (Test Coverage Gaps): "Untested: commands.ts, index.ts, paths.ts." The explore agent confirmed overview.ts, report.ts, and orchestrator-singleton.ts are also uncovered.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2: mediumShould fix — improves reliability or DXenhancementNew feature or requestgood first issueGood for newcomers

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions