Skip to content

Improve test coverage from 72% to 80% target #91

@richardwooding

Description

@richardwooding

Current Coverage Status

Latest measurement (Oct 31, 2025):

  • Main package: 72.2% statement coverage
  • pg package: 91.9% statement coverage
  • Gap to 80% target: 7.8 percentage points

This issue tracks the final push to reach our 80% coverage goal. We've already made excellent progress (from 55.6% in issue #51), and now need focused test additions for specific functions.

Priority Functions Needing Coverage

Priority 1: Functions <70% (Biggest Impact)

  1. callContains - 56.5% coverage

    • Test JSON array contains with ? operator
    • Test NULL handling in contains operations
    • Test empty string/array edge cases
    • Test contains with special characters needing escaping
  2. visitExistsOneComprehension - 64.0% coverage

    • Test zero matches scenario
    • Test exactly one match (happy path)
    • Test multiple matches scenario (should fail/error)
    • Test with empty arrays
  3. visitMapComprehension - 66.7% coverage

    • Test complex transformations (arithmetic, string operations)
    • Test nested map() operations
    • Test map with filter conditions
    • Test map with different return types
  4. callIndexOf - 67.7% coverage

    • Test offset parameter edge cases
    • Test not-found scenarios (should return -1)
    • Test negative offsets
    • Test offset beyond string length
  5. callSubstring - 68.0% coverage

    • Test single-argument version (substring from index to end)
    • Test two-argument version (substring with length)
    • Test negative indices
    • Test out-of-bounds scenarios
  6. visitAllComprehension - 69.2% coverage

    • Test with empty arrays
    • Test all true scenario
    • Test all false scenario
    • Test nested all() operations
    • Test all() with complex conditions

Priority 2: Functions 70-79% (Polish)

  1. visitFilterComprehension - 70.4% coverage

    • Test complex filter conditions (multiple ANDs/ORs)
    • Test filter with nested field access
    • Test filter on JSON arrays
  2. visitExistsComprehension - 72.0% coverage

    • Test exists on empty arrays
    • Test exists with complex predicates
    • Test nested exists() operations

Functions Explicitly Excluded

These functions are intentionally not targeted (0% coverage is acceptable):

  • getFieldElementType - Only used in rare ElementType scenarios
  • callQuote - Intentionally returns error (not part of CEL standard)
  • visitTransformListComprehension - Not reachable by pattern analyzer
  • visitTransformMapComprehension - Not implemented
  • visitTransformMapEntryComprehension - Not implemented
  • visitStructMsg - Not supported in standard CEL

Success Criteria

  • Main package coverage reaches 80%+
  • All 8 priority functions reach 80%+ individual coverage
  • All tests pass with make test
  • Code passes linting with make lint
  • No regressions in existing functionality

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions