test(agent-service): add unit test coverage for workflow-crud-tools#6380
Conversation
Automated Reviewer SuggestionsBased on the
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6380 +/- ##
============================================
+ Coverage 66.04% 66.80% +0.75%
Complexity 3380 3380
============================================
Files 1142 1142
Lines 44980 44920 -60
Branches 4948 4948
============================================
+ Hits 29709 30008 +299
+ Misses 13631 13272 -359
Partials 1640 1640
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds Bun unit tests for the agent-service workflow CRUD tool factories (createAddOperatorTool, createModifyOperatorTool, createDeleteOperatorTool) to exercise real WorkflowState mutations and real (in-memory) WorkflowSystemMetadata validation/predicate paths, without modifying production code.
Changes:
- Introduces
workflow-crud-tools.spec.tscovering success/error execution paths for add/modify/delete tools. - Uses an in-memory metadata store seeded via
loadFromMetadatato test validation behavior with real schemas. - Validates tool result strings and selected
WorkflowStatemutations.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
36df9a0 to
3aa6f47
Compare
What changes were proposed in this PR?
Add unit test coverage for the operator CRUD tool factories in
agent-service/src/agent/tools/workflow-crud-tools.ts—createAddOperatorTool,createModifyOperatorTool, andcreateDeleteOperatorTool. Abun testspec that builds each tool, callstool.execute(args), and asserts both the returned result string and the resultingWorkflowState. No production-code changes.The tools mutate an in-memory
WorkflowState, so the spec uses a realWorkflowStateand a real (in-memory,loadFromMetadata-seeded)WorkflowSystemMetadata— no network and no mocks; validation and predicate construction run through the genuine code paths.Any related issues, documentation, discussions?
Closes #6375.
How was this PR tested?
16 pass.
bun run typecheck(tsc) andbun run format:check(prettier) are clean; the fullbun testsuite is 146 pass / 0 fail. I also verified the failure path (broke one assertion -> 1 fail, exit 1 -> reverted). Coverage:operatorIdnot matchingop<number>; duplicateoperatorId; properties failing validation; input port index out of range / negative; missing source operator; valid source operator; valid operator linked to an existing source.inputOperatorIdsreplacing existing incoming links.Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 4.8 [1M context])