Improve test quality in step_types_test.go: convert manual assertions to testify #10067
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.
Converts 20+ manual error checks to testify assertions and adds edge case coverage in
pkg/workflow/step_types_test.go.Changes
Manual assertions → testify:
t.Errorf()withassert.*()for validationst.Fatalf()withrequire.*()for setup stepsEdge case tests added:
TestMapToStep_InvalidTypes- non-integer timeout-minutes, string expressions, non-string env valuesTestClone_DeepNestedMaps- validates shallow copy behavior with nested mapsTestToYAML_ErrorHandling- complex nested structures, special characters, multiline stringsTestSliceToSteps_MixedValidInvalid- invalid step types, empty mapsLinting fixes:
assert.Len()for length comparisonsassert.NotEqual()argument orderExample
Before:
After:
Test coverage: 15 functions (11 improved, 4 new edge cases)
Original prompt
This section details on the original issue you should resolve
<issue_title>[testify-expert] Improve Test Quality: pkg/workflow/step_types_test.go</issue_title>
<issue_description>The test file
pkg/workflow/step_types_test.godemonstrates excellent testing practices but has opportunities for improvement. This issue provides specific recommendations to enhance test quality using testify best practices.Current State
pkg/workflow/step_types_test.gopkg/workflow/step_types.goStrengths ✅
Areas for Improvement 🎯
1. Convert Manual Assertions to Testify
Lines to update: 32-34, 64-66, 159-161, 273-275, 305-307, 310-313, 315-318, 320-323, 361-363, 365-367, 385-386, 391-393, 397-400
2. Add Assertion Messages
All assertions should include descriptive messages:
3. Add Edge Case Tests
Missing tests:
Implementation Priority
Best Practices from specs/testing.md
require.*for critical setupassert.*for test validationst.Run()t.Errorfin many placesTesting Commands
Acceptance Criteria
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.