Commit acd3d37
committed
Add comprehensive SWE Common position type tests
Issue: Sam-Bolling/CSAPI-Live-Testing#43
Added 27 new tests for previously untested SWE Common position extraction paths:
Vector Positions (5 tests):
- 2D and 3D Vector coordinate extraction
- Missing value handling (defaults to 0)
- Insufficient coordinates (< 2) returns null
- Missing coordinates array returns null
DataRecord Positions (12 tests):
- Field name variations: lat/latitude, lon/longitude/long, alt/altitude/h
- Altitude defaulting to 0 when missing
- Missing latitude or longitude returns null
- Empty fields array returns null
- Case-sensitive field name matching (documents limitation)
- Zero coordinates (0,0) as valid position
DataArray Trajectory Positions (6 tests):
- Last position extraction from multi-point trajectories
- 2D and 3D trajectory support
- Single-point trajectory handling
- Empty values array returns null
- Missing values property returns null
- Insufficient coordinates in last value returns null
Unsupported Position Types (4 tests):
- TextComponent returns null (geocoding not supported)
- XLink reference returns null (external fetch not supported)
- Null position returns null
- Undefined position returns null
Test Coverage Impact:
- Before: 54 tests in base.spec.ts
- After: 81 tests in base.spec.ts (+27 tests, +50% increase)
- Untested code: ~79 lines (Vector, DataRecord, DataArray, unsupported types)
- Now tested: All major SWE Common position extraction paths
All tests pass and validate correct behavior of the extractGeometry() function
for SWE Common position formats used in CSAPI server responses.1 parent 53e43b9 commit acd3d37
1 file changed
Lines changed: 495 additions & 0 deletions
0 commit comments