Skip to content

test(cli): add unit tests for dashboard runs CLI commands#939

Merged
aaight merged 1 commit intodevfrom
feature/runs-cli-unit-tests
Mar 17, 2026
Merged

test(cli): add unit tests for dashboard runs CLI commands#939
aaight merged 1 commit intodevfrom
feature/runs-cli-unit-tests

Conversation

@aaight
Copy link
Copy Markdown
Collaborator

@aaight aaight commented Mar 17, 2026

Summary

  • Adds tests/unit/cli/dashboard/runs/runs.test.ts with 34 unit tests covering all 9 runs CLI commands (list, show, logs, llm-calls, llm-call, debug, trigger, retry, cancel)
  • Follows the DashboardCommand pattern from tests/unit/cli/dashboard/projects/integration-credentials.test.ts — mocks loadConfig, createDashboardClient, and chalk; uses a makeClient() factory
  • Uses vi.useFakeTimers() for the debug --analyze --wait polling tests

Test coverage per command

  • list — all filter flags (project, status, agent-type, limit, offset, sort, order), default values, pagination message, no-pagination case
  • show — passes run ID to getById.query, JSON output
  • logs — passes run ID, string/array output, "No logs found" message
  • llm-calls — passes run ID, JSON output
  • llm-call — passes run ID + call number, JSON output
  • debug (show) — fetches analysis, handles null with helpful message, JSON output for both null and real analysis
  • debug (trigger) — triggers analysis without waiting, JSON result flag
  • debug (trigger+wait) — polls until completed, stops on idle, logs timeout after 5-min deadline with vi.useFakeTimers()
  • trigger — passes project + agent-type, optional work-item-id + model, requires required flags, JSON output
  • retry — passes run ID, optional model override, JSON output
  • cancel — passes run ID, default/custom reason, JSON output

Test plan

  • npx vitest run --project unit-core tests/unit/cli/dashboard/runs/ — 34 tests pass
  • npx biome check tests/unit/cli/dashboard/runs/runs.test.ts — no lint errors

Trello card: https://trello.com/c/7qP5NXnK/458-as-a-developer-i-want-unit-tests-for-dashboard-runs-cli-commands-so-that-run-management-flows-are-covered

🤖 Generated with Claude Code

🕵️ claude-code · claude-sonnet-4-6 · run details

Copy link
Copy Markdown
Collaborator

@nhopeatall nhopeatall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — Well-structured unit tests that follow the established DashboardCommand test pattern from integration-credentials.test.ts. All 9 runs CLI commands are covered with correct tRPC client mocking, flag/argument mapping verified against the source implementations, and the vi.useFakeTimers() approach for the debug polling tests is sound. CI is green.

🕵️ claude-code · claude-opus-4-6 · run details

@aaight aaight merged commit 2c5f7dd into dev Mar 17, 2026
5 checks passed
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants