commit b20dfaeccb10cea21b70be3819c89654238d5776
parent 9f33c089f557b06f8a46c7f07a76688c85f33412
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}"
+ );
+ }
}
}