You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Summary
Add comprehensive unit tests for `OmnectDeviceServiceClient` to validate
client configuration, URL building, version requirements, and state
tracking.
## Tests Added (15)
### URL Building (5 tests)
- ✅ Normalizes path with leading slash
- ✅ Normalizes path without leading slash
- ✅ Normalizes path with multiple leading slashes
- ✅ Handles empty path
- ✅ Handles root path
### Version Requirements (3 tests)
- ✅ Parses required version correctly (>=0.39.0)
- ✅ Matches valid versions (0.39.0, 0.40.0, 1.0.0)
- ✅ Rejects older versions (0.38.9, 0.30.0, 0.1.0)
### Healthcheck Logic (3 tests)
- ✅ Detects version mismatch when below requirement
- ✅ Detects no mismatch when matching requirement
- ✅ Includes network rollback status
### Publish Endpoint State (2 tests)
- ✅ New client has no publish endpoint
- ✅ Client tracks publish endpoint registration
### Constants (2 tests)
- ✅ API endpoints are correctly defined
- ✅ Required version constant is valid semver
## Implementation Details
- Tests focus on pure logic without requiring HTTP/Unix socket
connections
- Version matching uses `semver` crate for validation
- URL building tested with edge cases (empty, multiple slashes, etc.)
- Constants validated to prevent typos in API paths
## Test Results
```bash
cargo test --features mock omnect_device_service_client::tests
```
Signed-off-by: Jan Zachmann <[email protected]>
0 commit comments