Conversation
This commit adds 10 new unit tests that significantly improve test coverage for the Oxpecker.OpenApi Configuration module, focusing on the previously untested OpenApiConfig.Build method and edge cases in RequestBody/ResponseBody. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
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.
Daily Test Coverage Improver - Oxpecker.OpenApi Configuration Tests
Summary
This PR adds 10 comprehensive unit tests for the
Oxpecker.OpenApi.Configurationmodule, significantly improving coverage for the previously under-tested OpenAPI configuration functionality. The new tests target theOpenApiConfig.Buildmethod and edge cases in request/response body configuration that had minimal coverage.Problems Found
The
Oxpecker.OpenApipackage had extremely low test coverage:OpenApiConfig.Buildmethod (lines 48-59) had no meaningful testsWhile basic "can create object" tests existed, they provided no validation of actual functionality, leaving critical code paths untested.
Actions Taken
Added 10 new comprehensive unit tests to
tests/Oxpecker.OpenApi.Tests/Configuration.Tests.fs:OpenApiConfig.Build Method Tests (7 tests)
OpenApiConfig Build adds metadata to endpoint with requestBody- Tests Build method with request body configurationOpenApiConfig Build adds metadata to endpoint with responseBodies- Tests Build method with response body configurationOpenApiConfig Build adds metadata to endpoint with configureOperation- Tests Build method with operation customizationOpenApiConfig Build with all options adds all metadata- Tests Build method with all configuration options combinedOpenApiConfig Build with empty responseBodies sequence- Tests Build method handles empty sequencesOpenApiConfig Build with multiple responseBodies- Tests Build method with multiple status codes (200, 201, 400, 404, 500)OpenApiConfig configureOperation can modify multiple operation properties- Tests operation customization with Summary, Description, OperationId, and Deprecated propertiesEdge Case Tests (3 tests)
ResponseBody with no content types specified- Tests default content type handlingRequestBody with empty content types array- Tests empty content type array handlingResponseBody with no content types specifiedassertion (was expecting null, should expect empty array)All tests follow existing patterns:
[<Fact>]attributesshouldEqual,shouldNotEqual)IEndpointConventionBuilderfor testing Build methodTest Coverage Results
All 778 tests passing ✓ (Note: 1 pre-existing test failure in ViewEngine.Tests unrelated to this PR)
Key Achievement: Oxpecker.OpenApi module improved by 45.4% in relative terms (from 30.99% to 45.07%), bringing it closer to the project's overall coverage level.
Replicating the Test Coverage Measurements
To replicate these measurements:
Before and After Summary
Before:
After:
Future Improvement Opportunities
Based on the coverage analysis, the following areas still have opportunities for improvement:
Routing.fs (OpenApi) - 27.08% line coverage, 26/96 lines covered
routeffunction OpenAPI parameter generationgetSchemafunction with all format specifiers ('s', 'i', 'b', 'c', 'd', 'f', 'u', 'O')addOpenApiSimplewith different type combinationsConfiguration.fs (OpenApi) - Still at ~60% line coverage
Other Low-Coverage Modules
All bash commands run
Web searches performed
None
Web pages fetched
None
Note: This is a draft PR. Please review the changes to ensure they align with project standards and test quality expectations.