Skip to content

test(validators): fix naming and add missing coverage (#427)#447

Merged
nanotaboada merged 1 commit intomasterfrom
test/validator-test-gaps-and-naming-alignment
Apr 4, 2026
Merged

test(validators): fix naming and add missing coverage (#427)#447
nanotaboada merged 1 commit intomasterfrom
test/validator-test-gaps-and-naming-alignment

Conversation

@nanotaboada
Copy link
Copy Markdown
Owner

@nanotaboada nanotaboada commented Apr 4, 2026

Summary

  • Rename ValidateAsync_SquadNumber_BelongsToPlayerBeingUpdated_ReturnsNoErrorsValidateAsync_SquadNumberBelongsToPlayerBeingUpdated_ReturnsNoErrors to comply with the 3-segment naming convention for service/validator tests
  • Add ValidateAsync_SquadNumberNegative_ReturnsValidationError to exercise the GreaterThan(0) rule (a negative value passes NotEmpty() but fails the greater-than rule — a different rule and message path, previously untested)
  • Add ValidateAsync_FirstNameEmptyInUpdateRuleSet_ReturnsValidationError to verify the "Update" rule set enforces structural field validation
  • Make CSharpier step in /pre-commit conditional, consistent with the Docker and CodeRabbit steps

Closes #427

Test plan

  • dotnet build --configuration Release passes
  • dotnet test --settings .runsettings — all 41 tests pass
  • dotnet csharpier --check . passes
  • No regressions

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests

    • Added validation test coverage for player validation rules, including negative squad number and empty first name scenarios.
    • Improved test method naming consistency.
  • Documentation

    • Updated development documentation and changelog to reflect changes in validation testing and pre-commit workflow flexibility.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 4, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c5fa5843-5a41-4546-b36d-59f7b42f9f4d

📥 Commits

Reviewing files that changed from the base of the PR and between b781936 and 8bb8774.

📒 Files selected for processing (3)
  • .claude/commands/pre-commit.md
  • CHANGELOG.md
  • test/Dotnet.Samples.AspNetCore.WebApi.Tests/Unit/PlayerValidatorTests.cs

Walkthrough

PR addresses three test coverage gaps in PlayerValidatorTests.cs: renames one test method to follow naming conventions (3-segment format), adds a test for GreaterThan(0) rule with negative SquadNumber, and adds a test for the "Update" rule set's structural validation. Additionally updates the pre-commit checklist to conditionally run CSharpier based on availability.

Changes

Cohort / File(s) Summary
Validator Test Coverage
test/Dotnet.Samples.AspNetCore.WebApi.Tests/Unit/PlayerValidatorTests.cs
Added two new test methods: ValidateAsync_SquadNumberNegative_ReturnsValidationError (exercises the GreaterThan(0) rule with negative input) and ValidateAsync_FirstNameEmptyInUpdateRuleSet_ReturnsValidationError (verifies "Update" rule set structural validation). Renamed ValidateAsync_SquadNumber_BelongsToPlayerBeingUpdated_ReturnsNoErrors to follow 3-segment naming convention.
Documentation & Changelog
.claude/commands/pre-commit.md, CHANGELOG.md
Updated pre-commit checklist step 4 to conditionally run dotnet csharpier --check . only if the tool is available; documented alignment with Docker and CodeRabbit steps in CHANGELOG.md.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Assessment against linked issues

Objective Addressed Explanation
Rename test method to follow 3-segment naming convention (#427)
Add test for GreaterThan(0) rule with negative SquadNumber (#427)
Add test for "Update" rule set structural validation (#427)

Out-of-scope changes

Code Change Explanation
Made CSharpier pre-commit step conditional (.claude/commands/pre-commit.md) This change is not mentioned in linked issue #427, which focuses solely on validator test gaps and naming convention alignment. The pre-commit modification appears to be an ancillary improvement not part of the stated objectives.

Possibly related PRs

🚥 Pre-merge checks | ✅ 1 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title follows Conventional Commits format with 'test:' prefix, is under 80 characters (60 chars), and accurately describes the main changes: renaming validator test methods and adding missing test coverage.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

📋 Issue Planner

Built with CodeRabbit's Coding Plans for faster development and fewer bugs.

View plan used: #427

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/validator-test-gaps-and-naming-alignment
  • 🛠️ sync documentation: Commit on current branch
  • 🛠️ sync documentation: Create PR
  • 🛠️ enforce http error handling: Commit on current branch
  • 🛠️ enforce http error handling: Create PR
  • 🛠️ idiomatic review: Commit on current branch
  • 🛠️ idiomatic review: Create PR
  • 🛠️ verify api contract: Commit on current branch
  • 🛠️ verify api contract: Create PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Apr 4, 2026

@nanotaboada nanotaboada merged commit ed03238 into master Apr 4, 2026
9 checks passed
@nanotaboada nanotaboada deleted the test/validator-test-gaps-and-naming-alignment branch April 4, 2026 08:07
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.

Validator test gaps and naming convention alignment

1 participant