Skip to content

test(cli): add unit tests for dashboard users, org, and agents commands#941

Merged
aaight merged 1 commit intodevfrom
feature/unit-tests-dashboard-users-org-agents
Mar 17, 2026
Merged

test(cli): add unit tests for dashboard users, org, and agents commands#941
aaight merged 1 commit intodevfrom
feature/unit-tests-dashboard-users-org-agents

Conversation

@aaight
Copy link
Copy Markdown
Collaborator

@aaight aaight commented Mar 17, 2026

Summary

  • Add unit tests for 10 dashboard CLI commands across 3 groups: users (list, create, update, delete), org (show, update), agents (list, create, update, delete)
  • Tests follow the established mock pattern from tests/unit/cli/dashboard/projects/ — mocking loadConfig, createDashboardClient, and chalk
  • 41 tests total covering happy-path flows, partial flag combinations, JSON output, and error/missing-argument cases

Test coverage

  • users list — calls client.users.list.query, table/JSON output, empty list
  • users create — passes email, password, name, role flags; defaults role to member; requires all required flags
  • users update — passes user ID with partial flags (name, email, role, password) individually and together
  • users delete — passes user ID with --yes bypass; auto-accepts in non-TTY environments
  • org show — calls client.organization.get.query, detail/JSON output, handles null org
  • org update — passes --name flag to mutate; requires --name
  • agents list — passes --project-id filter; requires --project-id
  • agents create — passes agent-type, project-id, model, engine, max-iterations, max-concurrency; requires required flags
  • agents update — passes ID with model, max-iterations, engine flags individually and together
  • agents delete — passes ID with --yes bypass; auto-accepts in non-TTY environments

Test plan

  • npx vitest run --project unit-core tests/unit/cli/dashboard/users/ tests/unit/cli/dashboard/org/ tests/unit/cli/dashboard/agents/ → 41 tests pass
  • npx biome check passes on all new files

Trello card: https://trello.com/c/vgq5jssj/460-as-a-developer-i-want-unit-tests-for-dashboard-users-org-and-agents-cli-commands-so-that-user-org-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 — Clean, well-structured unit tests that follow the established mock pattern from tests/unit/cli/dashboard/projects/. Verified all 3 test files against their source implementations: mock client shapes match actual tRPC client usage, CLI flag-to-payload mappings are correct (e.g., --engineagentEngine), argument types match (Args.integer for agent IDs, Args.string for user UUIDs), required-field validation is tested, and default values (role → member) are covered. CI is green (41/41 tests pass).

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

@aaight aaight merged commit bc9c083 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