facett-security/tests/robot.rs
//! **Robot JSON-drive scenario for the security / supply-chain view**, driven
//! through the SHARED generic-Facet probe in `facett_core::harness`. The pane's
//! `update_json` robot seam was a **dead no-op** (its hand-written `impl Facet`
//! never overrode it); this makes it LIVE and proves it end-to-end, and adds the
//! shared probe's `headless_render` + `responds_to_input` functional cells via
//! `facett_core::testmatrix::probe_and_emit` (no-op unless built with
//! `--features testmatrix`). `responds_to_input` is NEW coverage that goes RED if
//! the drive seam regresses. See `.nornir/facett-platform-gaps.md`.
use facett_security::SecurityView;
#[test]
fn robot_json_drive_scenario() {
let mut view = SecurityView::local();
let script = [
r#"{"select":"CVE-2024-31337"}"#, // drill into a finding
r#"{"select":null}"#, // clear the drill-in
];
let probe = facett_core::testmatrix::probe_and_emit("facett-security", &mut view, &script);
assert!(probe.drew(), "the security view must tessellate to vertices");
assert!(probe.cardinality() > 0, "state_json reports the findings");
assert!(probe.responded(), "update_json must drive state — a dead seam is a regression");
assert_eq!(
probe.steps[0].state["selected"], "CVE-2024-31337",
"select pins the finding id"
);
assert!(probe.steps[0].changed, "select moved state");
assert_eq!(probe.final_state["selected"], serde_json::Value::Null, "select:null cleared it");
}