facett-stat/tests/robot.rs
//! **Robot JSON-drive scenario for the stat grid**, driven through the SHARED
//! generic-Facet probe in `facett_core::harness`. The pane's `update_json` robot
//! seam was a **dead no-op** (the `impl_facet_via_elm!` bridge generates none);
//! 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_stat::StatGridView;
#[test]
fn robot_json_drive_scenario() {
let mut view = StatGridView::local();
let script = [
r#"{"set_title":"Renamed stats"}"#, // re-title (the deck keys facets off this)
r#""clear_rows""#, // drop every row (empty-state)
];
let probe = facett_core::testmatrix::probe_and_emit("facett-stat", &mut view, &script);
assert!(probe.drew(), "the stat grid must tessellate to vertices");
assert!(probe.cardinality() > 0, "state_json reports the rows");
assert!(probe.responded(), "update_json must drive state — a dead seam is a regression");
assert_eq!(probe.steps[0].state["title"], "Renamed stats", "set_title lands in state_json");
assert!(probe.steps[0].changed, "set_title moved state");
}