test(formatter): increase pkg/ coverage from 75.5% to 87.6%#17
Merged
Conversation
Added comprehensive test cases to improve formatter package coverage: - Added TestFormatTableValue with 18 test cases covering all data types: * String handling (short, long, truncation at 50 chars) * Array formatting (empty, 1-3 items, >3 items) * Map formatting (empty, with fields) * Number formatting (float64, int, int64, positive/negative) * Boolean values (true/false) * Nil values - Added TestToJSON_Error to test error handling with unmarshalable types (channels) - Added TestToTable_EdgeCases with 6 additional scenarios: * Slice of non-maps * Empty data arrays in API wrappers * JSON:API single objects without timeseries * JSON:API with array relationships * Unmarshalable types (functions) * API wrappers with non-map data - Added TestFlattenJSONAPIObject with 6 test cases: * Simple objects with attributes * Single relationships * Array relationships * Empty relationship arrays * Combined attributes and relationships * Relationships without data field This brings overall pkg/ coverage to 87.6%, exceeding the 80% threshold. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
📊 Test Coverage ReportThreshold: 80% ✅ Coverage by Package📈 Coverage Status: ✅ PASSED - Coverage meets minimum threshold Updated for commit f7c9b4e |
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.
Summary
Increased overall pkg/ test coverage from 75.5% to 87.6%, exceeding the 80% threshold required by CI. The formatter package saw the most significant improvement, going from 72.7% to 88.6% coverage.
Changes
TestFormatTableValue: 18 test cases covering all data types (nil, strings, arrays, maps, numbers, bools)TestToJSON_Error: Error handling for unmarshalable types (channels)TestToTable_EdgeCases: 6 additional scenarios for edge casesTestFlattenJSONAPIObject: 6 test cases for JSON:API object flatteningCoverage Improvements
Formatter Package Functions
formatTableValue: 36.8% → 100.0% (+63.2%)flattenJSONAPIObject: 72.0% → 100.0% (+28.0%)ToJSON: 75.0% → 100.0% (+25.0%)ToTable: 61.5% → 74.4% (+12.9%)formatSliceAsTable: 82.6% → 89.1% (+6.5%)Overall Package Coverage
Testing
Related Issues
Addresses the requirement to maintain >80% test coverage as specified in docs/TESTING.md and enforced by CI (.github/workflows/ci.yml line 64).
🤖 Generated with Claude Code