Skip to content

Commit c7efd96

Browse files
committed
Ensure we don't break webapp links
1 parent a8dd30c commit c7efd96

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

src/rulesets/ty_based.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ pub static KNOWN_TY_BASED_BUNDLES: &[BundleDoc<RuleOptions>] = &[
517517
fallback_to_outer: FallbackToOuterBehavior::EatBoth,
518518
..RuleOptions::STATELESS_2021
519519
},
520-
doc: "A backwards-compatible proposal by @dianne that behaves close to the\
520+
doc: "A backwards-compatible proposal by @dianne that behaves close to the \
521521
2024 stateless proposal.",
522522
},
523523
BundleDoc {

src/wasm.rs

+24
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,30 @@ fn decode_base64<T: Decode>(x: JsValue) -> Option<T> {
2727
Some(bincode::decode_from_slice(&bits, config).ok()?.0)
2828
}
2929

30+
#[test]
31+
/// Ensure we don't change the encoding of rulesets, as that would break saved links into the app.
32+
fn ruleset_encodings() -> anyhow::Result<()> {
33+
use std::fmt::Write;
34+
let mut out = String::new();
35+
for b in KNOWN_TY_BASED_BUNDLES {
36+
let ruleset = RuleSetJs {
37+
this_solver: true,
38+
ty_based: b.ruleset,
39+
bm_based: Conf::rfc2005(),
40+
};
41+
let _ = writeln!(&mut out, "{}: {}", b.name, ruleset.encode());
42+
}
43+
insta::with_settings!({
44+
snapshot_path => "../tests/snapshots",
45+
snapshot_suffix => "ruleset-encodings",
46+
prepend_module_to_snapshot => false,
47+
omit_expression => true,
48+
}, {
49+
insta::assert_snapshot!(out);
50+
});
51+
Ok(())
52+
}
53+
3054
/// Like `RuleSet` but remembers the ruleset of the other solver to avoid losing state in the
3155
/// frontend.
3256
#[wasm_bindgen]

0 commit comments

Comments
 (0)