test(js): cover fingerprint mismatch fallback

Assert the browser runtime refuses stale partial/effect updates when deployment fingerprints mismatch and falls back to reload instead of applying stale ids.

req: abi/003

req: abi/004

req: runtime/004
This commit is contained in:
slhx agent
2026-05-25 22:42:19 +02:00
parent 756f5a50cb
commit 88c339c5c3
+13
View File
@@ -67,6 +67,19 @@ fn runtime_exposes_page_swap_hooks() {
assert!(source.contains("location.href = href")); assert!(source.contains("location.href = href"));
} }
#[test]
fn runtime_refuses_partial_updates_on_fingerprint_mismatch() {
// req: abi/003 req: abi/004 req: runtime/004
let source = slhx_js::RUNTIME_JS;
assert!(source.contains("function compatibleFingerprint(response, root)"));
assert!(source.contains("const received = response.headers.get(\"x-slhx-fingerprint\")"));
assert!(source.contains("const expected = root && root.getAttribute(FINGERPRINT)"));
assert!(source.contains("if (!compatibleFingerprint(response, root))"));
assert!(source.contains("location.reload()"));
assert!(source.contains("if (expected && String(batch.fingerprint) !== expected)"));
}
#[test] #[test]
fn runtime_page_swaps_lowered_slot_ids() { fn runtime_page_swaps_lowered_slot_ids() {
// req: wire/001 // req: wire/001