crates/monetize-ui-server/tests/screens_overview.rs
//! ★ **OVW-4 (2026-10-29): the mock monetize serves the Overview.** The browser matrix's row
//! "estates: the Overview is one row per estate" read no names: uitest's mock answered neither
//! `Estates.Overview` nor `Guardian.Cases`, so `/api/overview` refused and every row's
//! `/api/estates/<name>/summary` had no fleet to find its estate in. The BFF over the mock now
//! lists the fixture's estates, and each row reads its own summary.
#[path = "../../../uitest/src/fixture.rs"]
mod fixture;
#[path = "../../../uitest/src/mock.rs"]
mod mock;
mod screens_rig;
use screens_rig::Rig;
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn the_mocks_overview_is_one_row_per_estate_and_each_row_reads_its_summary() {
let rig = Rig::up().await;
let o = rig.get("/api/overview").await;
let names: Vec<String> = o["estates"].as_array().map(|a| a.iter().filter_map(|e| e["name"].as_str().map(str::to_owned)).collect()).unwrap_or_default();
assert_eq!(names, fixture::ESTATES.iter().map(|(n, ..)| n.to_string()).collect::<Vec<_>>(), "the Overview names the fixture's estates: {o}");
for (n, product, domain) in fixture::ESTATES {
let row = o["estates"].as_array().unwrap().iter().find(|e| e["name"] == *n).unwrap();
assert_eq!((row["product"].as_str(), row["domain"].as_str(), row["in_fleet"].as_bool()), (Some(*product), Some(*domain), Some(true)), "{row}");
let s = rig.get(&format!("/api/estates/{n}/summary")).await;
assert_eq!(s["estate"], *n, "{s}");
assert_eq!(s["reached"], true, "the fixture's estate reports in: {s}");
}
}