Skip to content

Conversation

@github-actions
Copy link
Contributor

Summary

This PR systematically improves test coverage by adding comprehensive tests for two previously untested areas with 0% coverage:

JSON Runtime Helpers (FSharp.Data.Json.Core) - Added 5 test methods covering private helper functions through public API edge case testing
BaseTypes.HtmlDocument (FSharp.Data.Html.Core) - Added new test file with 16 test methods covering all HtmlDocument functionality

Coverage Analysis

Before

  • Overall baseline: 42.6% line coverage
  • JSON Runtime Helpers: 0% coverage (private functions: inRangeDecimal, inRangeFloat, isIntegerDecimal, isIntegerFloat)
  • BaseTypes.HtmlDocument: 0% coverage (methods: Create, Html, GetTable, GetList, GetDefinitionList)

Improvements Made

JSON Runtime Helpers Testing

  • Boundary value testing: Tests exact Int32/Int64 min/max values to trigger inRangeDecimal/inRangeFloat functions
  • Integer detection testing: Tests decimal/float values that are/aren't integers to trigger isIntegerDecimal/isIntegerFloat
  • Edge case coverage: Floating-point precision limits, special values (NaN, infinity), exact boundary conditions
  • Method: Private functions tested through public JsonConversions API using strategic edge cases

BaseTypes.HtmlDocument Testing

  • Complete method coverage: All class methods and properties tested
  • Error handling: Exception testing for missing elements (KeyNotFoundException)
  • HTML parsing scenarios: Valid HTML, malformed HTML, empty HTML, multiple elements
  • Parameter variations: Tests includeLayoutTables true/false scenarios
  • Integration testing: Tests element retrieval by ID for tables, lists, and definition lists

Test Details

Files Changed

  • tests/FSharp.Data.Core.Tests/JsonConversions.fs: Added 93 lines with 5 new test methods
  • tests/FSharp.Data.Core.Tests/BaseTypesHtmlDocument.fs: New file with 258 lines, 16 test methods
  • tests/FSharp.Data.Core.Tests/FSharp.Data.Core.Tests.fsproj: Added new test file to compilation

Technical Implementation

  • Framework: All tests use NUnit with FsUnit assertions following project patterns
  • F# Compliance: Proper handling of F# type system constraints (non-nullable types)
  • Compiler Integration: Added #nowarn "10001" for BaseTypes methods intended for generated code
  • Test Categories: Comprehensive edge case testing, error condition testing, boundary value analysis

Test Plan

All tests pass: 16/16 BaseTypes.HtmlDocument tests pass
JSON tests verified: 5/5 new JsonConversions tests pass with edge cases
Build successful: No compilation errors or warnings
Coverage collection: Updated coverage report generated successfully

Quality Assurance

  • Code follows existing patterns: Matches established test conventions in the codebase
  • No breaking changes: Only additive test coverage improvements
  • Edge case focus: Tests specifically target previously untested code paths
  • Error handling: Comprehensive exception testing with proper F# error patterns

Related Issues

🤖 Generated with Claude Code

…s.HtmlDocument

This commit significantly improves test coverage for two previously untested areas:

**JSON Runtime Helpers (FSharp.Data.Json.Core)**
- Added 5 comprehensive test methods targeting the private Helpers module
- Tests exercise edge cases for inRangeDecimal, inRangeFloat, isIntegerDecimal, and isIntegerFloat functions
- Coverage includes boundary value testing for Int32/Int64 ranges
- Tests integer detection for both decimal and float values
- Added floating-point precision and special value handling (NaN, infinity)

**BaseTypes.HtmlDocument (FSharp.Data.Html.Core)**
- Created new test file with 16 comprehensive test methods
- Tests all HtmlDocument class methods: Create, Html property, GetTable, GetList, GetDefinitionList
- Coverage includes error handling, malformed HTML parsing, multiple elements
- Tests both includeLayoutTables true/false scenarios
- Added exception testing for missing elements

**Test Framework Integration**
- All tests use NUnit framework with FsUnit assertions
- Tests follow existing project patterns and conventions
- Added appropriate compiler warnings suppression for BaseTypes methods
- All tests pass successfully with proper F# type safety

**Coverage Impact**
- Baseline: 42.6% overall line coverage
- Target areas previously had 0% coverage
- New tests provide comprehensive edge case and error condition coverage

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@dsyme dsyme marked this pull request as ready for review August 31, 2025 22:36
@dsyme dsyme merged commit ca550e7 into main Aug 31, 2025
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.

2 participants