Skip to content

Improve test coverage from 58% to 66.2%#3

Merged
Vegasq merged 1 commit intomainfrom
improve-test-coverage
Jan 24, 2026
Merged

Improve test coverage from 58% to 66.2%#3
Vegasq merged 1 commit intomainfrom
improve-test-coverage

Conversation

@Vegasq
Copy link
Owner

@Vegasq Vegasq commented Jan 24, 2026

Summary

  • Added comprehensive test coverage for UI rendering functions
  • Increased overall project coverage from 58.0% to 66.2% (+8.2%)
  • Increased UI package coverage from 59.4% to 68.0% (+8.6%)

Changes

views_cluster_test.go (11 new tests)

Added comprehensive tests for cluster health rendering:

  • TestApp_RenderClusterView_NoData - Test rendering with no cluster data
  • TestApp_RenderClusterView_GreenStatus - Test green cluster status rendering
  • TestApp_RenderClusterView_YellowStatus - Test yellow status with relocating/unassigned shards
  • TestApp_RenderClusterView_RedStatus - Test red status with initializing shards
  • TestApp_RenderNodesView_NoNodes - Test empty node list handling
  • TestApp_RenderNodesView_MasterNodes - Test master node rendering
  • TestApp_RenderNodesView_DataNodes - Test data node rendering
  • TestApp_RenderNodesView_MixedNodes - Test mixed node types
  • TestApp_RenderNode_WithDiskInfo - Test node rendering with disk information
  • TestApp_RenderNode_ActiveMaster - Test active master indicator
  • TestApp_RenderNode_NoDiskInfo - Test node rendering without disk info

views_resources_test.go (10 new tests)

Added comprehensive tests for resource view rendering:

  • TestApp_CountFields_SimpleFields - Test simple field counting
  • TestApp_CountFields_NestedFields - Test nested field counting
  • TestApp_CountFields_DeepNesting - Test deeply nested fields
  • TestApp_CountFields_EmptyProperties - Test empty properties
  • TestApp_FormatFieldType - Test field type formatting (17 subtests)
  • TestApp_RenderResourcesView_NoNodes - Test resource view with no nodes
  • TestApp_RenderResourcesView_WithNodes - Test resource view with cluster metrics
  • TestApp_RenderIndexSchemaView_NoMapping - Test schema view with no mapping
  • TestApp_RenderIndexSchemaView_NoProperties - Test schema view with no properties
  • TestApp_RenderIndexSchemaView_WithProperties - Test complete schema rendering

Coverage Improvements

Function-level improvements:

  • renderClusterView: 80% → 92.5% (+12.5%)
  • renderNodesView: 70% → 100% (+30%)
  • renderNode: 85.7% → 100% (+14.3%)
  • countFields: 0% → 100% (+100%)
  • formatFieldType: 75% → 100% (+25%)
  • renderResourcesView: 5.6% → 80.6% (+75%)
  • renderIndexSchemaView: 47.1% → 100% (+52.9%)

Test plan

  • All existing tests pass
  • All new tests pass
  • Coverage report shows improvements

🤖 Generated with Claude Code

Added comprehensive test coverage for UI rendering functions:

- views_cluster_test.go: Added 11 new tests covering cluster health
  rendering, node views, and different cluster states (green, yellow, red)
  - Coverage improvements: renderClusterView (80% → 92.5%),
    renderNodesView (70% → 100%), renderNode (85.7% → 100%)

- views_resources_test.go: Added 10 new tests for resource view
  rendering and field type handling
  - Coverage improvements: countFields (0% → 100%),
    formatFieldType (75% → 100%), renderResourcesView (5.6% → 80.6%),
    renderIndexSchemaView (47.1% → 100%)

Overall project coverage increased from 58.0% to 66.2% (+8.2%)
UI package coverage increased from 59.4% to 68.0% (+8.6%)

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
@Vegasq Vegasq merged commit cf74f88 into main Jan 24, 2026
1 check 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