Skip to content

test(cli): add unit tests for dashboard prompts, webhooklogs, and webhooks commands#943

Merged
aaight merged 1 commit intodevfrom
feature/unit-tests-dashboard-prompts-webhooklogs-webhooks
Mar 17, 2026
Merged

test(cli): add unit tests for dashboard prompts, webhooklogs, and webhooks commands#943
aaight merged 1 commit intodevfrom
feature/unit-tests-dashboard-prompts-webhooklogs-webhooks

Conversation

@aaight
Copy link
Copy Markdown
Collaborator

@aaight aaight commented Mar 17, 2026

Summary

  • Add unit tests for 8 prompts commands (default, default-partial, variables, list-partials, get-partial, set-partial, reset-partial, validate)
  • Add unit tests for 2 webhooklogs commands (list, show)
  • Add unit tests for 3 webhooks commands (list, create, delete)

Closes: https://trello.com/c/69b99253366aead4bece40c9

Test plan

  • All 43 tests pass: npx vitest run --project unit-core tests/unit/cli/dashboard/prompts/ tests/unit/cli/dashboard/webhooklogs/ tests/unit/cli/dashboard/webhooks/
  • Lint passes with zero errors
  • Type checking passes with zero errors

Key decisions

  • Follows the established dashboard mock pattern from tests/unit/cli/dashboard/projects/integration-credentials.test.ts
  • Mocks loadConfig, createDashboardClient, and chalk at the module level using vi.mock
  • Mocks node:fs for prompts commands that read template/partial files from disk (set-partial, validate)
  • Tests verify that correct arguments/flags are passed through to the underlying tRPC client calls
  • Tests cover required flags enforcement (commands reject when required flags/args are missing)

🤖 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 test additions that closely follow the established dashboard mock pattern from integration-credentials.test.ts. All 3 test files consistently mock loadConfig, createDashboardClient, and chalk at the module level, and the node:fs mock for file-reading commands is appropriate. I verified the test assertions against the source implementations for all 13 commands and they accurately match the flag names, tRPC call shapes, and branching logic (e.g., reset-partial correctly tests both the source: 'db' deletion path and the source: 'disk' no-op path). CI is green across all checks.

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

@aaight aaight merged commit 227a365 into dev Mar 17, 2026
6 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