commit c0df8d682aab9ae4a239afe9871028dc743e5b53
parent 743bdcd8b509d8524f5af2556f077eed9e23e450
Author: triesap <tyson@radroots.org>
Date: Sat, 21 Feb 2026 15:24:10 +0000
core: make ts export literal assertions order-insensitive
- replace brittle union-string contains checks with per-literal membership assertions
- preserve coverage for all expected unit and unit-dimension values
- remove ordering dependency that caused non-deterministic ci failures in export step
- verify with `radroots-core` ts-rs tests and xtask sdk export-ts local run
Diffstat:
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/crates/core/src/lib.rs b/crates/core/src/lib.rs
@@ -81,7 +81,14 @@ mod ts_export_tests {
export_types();
let path = ts_export_dir().join("types.ts");
let raw = fs::read_to_string(path).expect("read generated core types");
- assert!(raw.contains("\"each\" | \"kg\" | \"g\" | \"oz\" | \"lb\" | \"l\" | \"ml\""));
- assert!(raw.contains("\"count\" | \"mass\" | \"volume\""));
+ for literal in ["\"each\"", "\"kg\"", "\"g\"", "\"oz\"", "\"lb\"", "\"l\"", "\"ml\""] {
+ assert!(raw.contains(literal), "missing core unit literal: {literal}");
+ }
+ for literal in ["\"count\"", "\"mass\"", "\"volume\""] {
+ assert!(
+ raw.contains(literal),
+ "missing core unit dimension literal: {literal}"
+ );
+ }
}
}