test(definitions): add unit tests for dashboard definitions CLI commands#942
Merged
test(definitions): add unit tests for dashboard definitions CLI commands#942
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
nhopeatall
approved these changes
Mar 17, 2026
Collaborator
nhopeatall
left a comment
There was a problem hiding this comment.
LGTM — Well-structured unit tests for all 9 definitions CLI commands. The test file follows the established mock pattern from agents.test.ts and integration-credentials.test.ts exactly (module-level mock functions, makeClient() factory, oclifConfig stub, beforeEach for config setup). All 39 tests pass, CI is green.
The test coverage is thorough:
- Happy paths for all commands (list, show, create, update, delete, export, import, reset, triggers)
- JSON output mode for each command
- Error/edge cases (missing required args/flags, empty lists, empty triggers)
- Import upsert logic (create → conflict → update with
--updateflag) correctly mirrors the source implementation - Agent type resolution precedence (file content vs
--agent-typeflag override) matches source behavior - YAML/JSON file parsing paths both exercised
🕵️ claude-code · claude-opus-4-6 · run details
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
list,show,create,update,delete,export,import,reset,triggersimportupsert logic (create → conflict → update with--updateflag) and agentType resolution from file vs.--agent-typeflagtests/unit/cli/dashboard/projects/integration-credentials.test.tsandtests/unit/cli/dashboard/agents/agents.test.tsTest plan
definitions list— callsclient.agentDefinitions.list.query, table/JSON output, empty listdefinitions show— passes agent type arg to query, text/JSON output, missing arg errordefinitions create— reads JSON and YAML files, passes agent-type + definition, JSON output, missing flag errordefinitions update— passes agent-type with patch from file (JSON/YAML), JSON output, missing flag errordefinitions delete— passes agent type with--yes, errors without--yes, JSON output, missing arg errordefinitions export— fetches single or all definitions, YAML/JSON format,--outputfile, stdout writedefinitions import(create path) — creates when definition doesn't existdefinitions import(upsert path) — falls back to update on conflict with--updateflagdefinitions import— resolves agentType from file,--agent-typeflag overrides file, YAML+JSON parsing, errors when agentType missingdefinitions reset— passes agent type with--yes, errors without--yes, JSON outputdefinitions triggers— passes agent type, displays triggers, JSON output, empty triggers, missing arg errornpx vitest run --project unit-core tests/unit/cli/dashboard/definitions/Card: https://trello.com/c/DT071HWQ/461-as-a-developer-i-want-unit-tests-for-dashboard-definitions-cli-commands-so-that-agent-definition-management-is-covered
🤖 Generated with Claude Code
🕵️ claude-code · claude-sonnet-4-6 · run details