crates/gunnar-recipe/tests/public_site_row.rs
//! **gunnar.rs's release build turns the public site on, and nothing else
//! does** (TASKS-12, the owner's SLIM RULE, 2026-10-25).
//!
//! The site is gunnar-ui's `gunnar-public-site` crate, linked by
//! gunnar-ui-server only under its `public-site` feature, off by default.
//! gunnar.rs is the PAID front, `gunnar-front-installer-metered`, whose payload
//! row is `gunnar-front-metered`: that row (and its dev-narrate twin) names
//! `public-site`; the open front, every gunnar-server row and gunnar-front's
//! default features do not. gunnar-server gets nothing new.
use gunnar_recipe::GunnarBuildThing;
use nornir_build_thing::plugin::BuildThing as _;
fn front_manifest() -> String {
std::fs::read_to_string(concat!(
env!("CARGO_MANIFEST_DIR"),
"/../gunnar-front/Cargo.toml"
))
.expect("gunnar-front's manifest")
}
#[test]
fn the_release_front_of_gunnar_rs_builds_the_public_site() {
let set = GunnarBuildThing.variants();
let installer = set
.installers
.iter()
.find(|i| i.name == "gunnar-front-installer-metered")
.expect("the metered front medium");
assert_eq!(installer.variant, "gunnar-front-metered");
for row in ["gunnar-front-metered", "gunnar-front-metered-narrate"] {
let v = set
.variants
.iter()
.find(|v| v.name == row)
.unwrap_or_else(|| panic!("no row {row}"));
assert!(
v.features.iter().any(|f| f == "public-site"),
"{row} must build gunnar.rs's public face: {:?}",
v.features
);
}
}
#[test]
fn no_other_row_builds_it() {
let set = GunnarBuildThing.variants();
for v in &set.variants {
if v.name == "gunnar-front-metered" || v.name == "gunnar-front-metered-narrate" {
continue;
}
assert!(
!v.features.iter().any(|f| f.contains("public-site")),
"{} builds the public site: {:?}",
v.name,
v.features
);
}
}
#[test]
fn gunnar_front_forwards_the_feature_and_leaves_it_off_by_default() {
let m = front_manifest();
assert!(
m.lines()
.any(|l| l.trim() == r#"public-site = ["console", "gunnar-ui-server/public-site"]"#),
"gunnar-front has no public-site feature"
);
let default = m
.lines()
.find(|l| l.starts_with("default = "))
.expect("a default line");
assert!(!default.contains("public-site"), "{default}");
}
#[test]
fn gunnar_server_gets_nothing_new() {
let server = std::fs::read_to_string(concat!(
env!("CARGO_MANIFEST_DIR"),
"/../gunnar-server/Cargo.toml"
))
.expect("gunnar-server's manifest");
assert!(!server.contains("public-site") && !server.contains("gunnar-public-site"));
}