test(telemetry-support): pin alias normalisation and YAML decode contract#512
test(telemetry-support): pin alias normalisation and YAML decode contract#512EffortlessSteven wants to merge 1 commit into
Conversation
…ract
Adds 18 tests for `racing-wheel-telemetry-support` covering paths
the existing suite did not exercise:
- `normalize_game_id` mixed-case aliases ("EA-WRC", "Ea Wrc",
"F1-2025", "F1 2025") and trim-plus-alias interaction
(" Ea-Wrc\t" → "eawrc"). Pins the case-insensitive contract.
- `normalize_game_id` returns the input verbatim (case preserved)
when no alias matches, after trimming.
- `GameSupportStatus` YAML decoder accepts the lowercase forms,
rejects "Stable"/"STABLE" (capitalisation) under
`rename_all="lowercase"`, and rejects unknown values like
"deprecated"/"retired".
- `GameSupportStatus::default()` is `Stable`; `Copy` semantics
exercised so removing the derive is caught.
- `GameSupportMatrix::game_ids_by_status` returns a sorted vec even
when entries are inserted in non-sorted order — uses a custom
matrix to avoid depending on the embedded YAML.
- `matrix_game_ids()` from the embedded YAML has no duplicates and
matches `GameSupportMatrix::game_ids()`.
- `TelemetryFieldMapping::clone` preserves all eight `Option<String>`
fields verbatim.
- `supports_360hz_option: true` without `high_rate_update_rate_hz`
parses; documents that the consistency invariant lives in tests.
- `output_target: ""` decodes to `Some("")` (distinct from `null`).
- `load_default_matrix()` keys equal `game_ids()` output.
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Compatibility Layer Usage ReportCurrent usage count: 193 📈 Usage Trend (Last 30 Days)
Usage Details
... and 183 more occurrences Migration GuideTo migrate these usages, replace:
See Migration Patterns for detailed examples. |
Summary
Adds 18 new tests for
racing-wheel-telemetry-support. The crate is the canonical loader forgame_support_matrix.yamland exposes anormalize_game_idboundary helper; both surfaces had branches that were not being exercised.What the new tests cover
normalize_game_idalias matrix.ea_wrc/ea-wrc/ea wrc→eawrcEA-WRC,Ea Wrc,eA_wRc,EA_WRC→eawrcf1_2025/f1-2025/f1 2025and uppercase variants →f1_25" Ea-Wrc\t"→eawrc)iracingstaysiracing,ACCkeeps its case)GameSupportStatusYAML decode.stable/experimentalStable/STABLE(rename_all = "lowercase" contract)deprecated,retiredGameSupportStatussemantics.default()isStableCopyworks (assign and reuse)GameSupportMatrix::game_ids_by_statussort guarantee. Uses a custom in-memory matrix with out-of-order inserts to confirm the result is sorted, rather than relying on the embedded YAML's order.matrix_game_ids()uniqueness. No duplicate IDs in the embedded matrix.TelemetryFieldMapping::clonepreserves all eightOption<String>fields verbatim.supports_360hz_option: truewithouthigh_rate_update_rate_hzparses successfully; documents that the cross-field invariant lives in tests, not the type.output_target: ""is distinct fromnull— decodes toSome(""), notNone.load_default_matrix()↔game_ids()consistency.Verification
Test plan
cargo test -p racing-wheel-telemetry-supportcargo clippy -p racing-wheel-telemetry-support --tests -- -D warningshttps://claude.ai/code/session_01NZ5jzdE2H3bbuPuYqbjCnh
Generated by Claude Code