Skip to content

test: improve coverage from 53% to 94%#3

Merged
basgys merged 1 commit intomainfrom
improve/test-coverage
Mar 16, 2026
Merged

test: improve coverage from 53% to 94%#3
basgys merged 1 commit intomainfrom
improve/test-coverage

Conversation

@basgys
Copy link
Contributor

@basgys basgys commented Mar 16, 2026

Summary

  • Restructure TestIs and TestAs to use t.Run with descriptive scenario names instead of index-based error messages
  • Add TestWith to verify all With* functions preserve the parent cause in the error chain
  • Add TestErrorMessage to validate the human-readable output of every error type (no violations, with violations, wrapping a cause)
  • Add TestViolationString to cover FieldViolation, QuotaViolation, PreconditionViolation, and ConflictViolation string formatting
  • Add missing coverage for IsUnimplemented and AsUnimplemented

Note

Low Risk
Low risk: changes are confined to faults_test.go and only increase assertions around error classification, wrapping/unwrapping behavior, and message formatting.

Overview
Significantly expands and restructures faults_test.go to use named t.Run scenarios and to cover more cases for Is*/As* helpers, including nested fmt.Errorf wrapping, negative cases, and the previously untested Unimplemented helpers.

Adds new tests verifying With* wrappers preserve the original cause via errors.Is, validates the exact Error() strings for singleton and constructed faults (including violations and wrapped causes), and covers String() formatting for all violation types.

Written by Cursor Bugbot for commit d576667. This will update automatically on new commits. Configure here.

Restructure existing tests to use t.Run with descriptive scenario names,
and add new test functions covering With*, error messages, and violation
string formatting.
@basgys basgys merged commit 9263491 into main Mar 16, 2026
2 checks passed
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.

1 participant