facett-holger/tests/matrix.rs
//! **The functional matrix cell for facett-holger** — the registry browser is a
//! full `Facet` but emitted NO testmatrix row of either aspect (see
//! `.nornir/docs/test-matrix-inventory-history.md`, "~10 panes emit no cell").
//!
//! ONE call through the shared generic-`Facet` probe (L5) — no bespoke harness.
//! It also pins the bug this round fixed: the `impl Facet` had no `update_json`
//! override, so every message sent **through `dyn Facet`** (the path a
//! `FacetDeck` and the probe use) hit the trait's no-op default and was dropped,
//! even though the inherent method worked. Remove the override again and
//! `responds_to_input` goes RED here.
use facett_holger::RegistryBrowser;
#[test]
fn holger_probe_emits_render_and_input_cells() {
let mut view = RegistryBrowser::from_fixture();
let script = [
r#"{"select_repo":"helm-charts"}"#,
r#"{"select_repo":"crates-mirror"}"#,
];
let probe = facett_core::testmatrix::probe_and_emit("facett-holger", &mut view, &script);
assert!(probe.drew(), "the registry browser must tessellate to vertices");
assert!(probe.cardinality() > 0, "state_json reports the repos/artifacts");
assert!(
probe.responded(),
"the dyn-Facet update_json seam must be live — the trait default is a silent no-op"
);
assert_eq!(probe.initial_state["backend"], "fixture");
assert_eq!(probe.initial_state["repo_count"], 8);
assert_eq!(probe.initial_state["selected_repo"], "crates-mirror");
assert_eq!(probe.steps[0].state["selected_repo"], "helm-charts");
assert_eq!(probe.steps[1].state["selected_repo"], "crates-mirror");
}
/// RED-when-broken: the seam must be reached through the TRAIT object, not only
/// the inherent method — that is exactly the difference the bug hid behind.
#[test]
fn dyn_facet_update_json_reaches_the_selection() {
let mut b = RegistryBrowser::from_fixture();
let f: &mut dyn facett_core::Facet = &mut b;
f.update_json(r#"{"select_repo":"helm-charts"}"#);
assert_eq!(f.state_json()["selected_repo"], "helm-charts");
// Garbage and unknown keys must not move it.
f.update_json("not json");
f.update_json(r#"{"nope":1}"#);
assert_eq!(f.state_json()["selected_repo"], "helm-charts");
}