Your browser sucks, JavaScript disabled! Gunnar's console needs JavaScript and WebAssembly. Git over SSH on port 2222 does not.

nordisk/gunnar

crates/gunnar-front/tests/public_site_off_by_default.rs

//! **The front's default build is the AIRGAP install** (owner 2026-10-25, the
//! SLIM RULE): gunnar-ui's `gunnar-public-site` (the public pages, robots.txt,
//! the sitemap, llms.txt and IndexNow, its one outbound call) is in
//! gunnar-front's tree only under its `public-site` feature, and neither the
//! default nor the metered build turns it on. Asked of cargo itself
//! (`cargo tree`, offline, against this lock).

use std::process::Command;

fn tree(features: &[&str]) -> String {
    let cargo = std::env::var("CARGO").unwrap_or_else(|_| "cargo".to_owned());
    let manifest = concat!(env!("CARGO_MANIFEST_DIR"), "/Cargo.toml");
    let mut cmd = Command::new(cargo);
    cmd.args([
        "tree",
        "--offline",
        "--locked",
        "--manifest-path",
        manifest,
        "-p",
        "gunnar-front",
        "-e",
        "normal",
        "--prefix",
        "none",
    ]);
    if !features.is_empty() {
        cmd.args(["--features", &features.join(",")]);
    }
    let out = cmd.output().expect("cargo tree runs");
    assert!(
        out.status.success(),
        "cargo tree failed: {}",
        String::from_utf8_lossy(&out.stderr)
    );
    String::from_utf8_lossy(&out.stdout).into_owned()
}

#[test]
fn the_default_front_does_not_contain_the_public_site() {
    let t = tree(&[]);
    assert!(
        t.contains("gunnar-ui-server"),
        "the default front carries the console: {t}"
    );
    assert!(
        !t.contains("gunnar-public-site"),
        "the default front links the public site:\n{t}"
    );
}

#[test]
fn the_metered_front_does_not_contain_it_either() {
    assert!(!tree(&["metered"]).contains("gunnar-public-site"));
}

#[test]
fn the_public_site_front_does() {
    assert!(tree(&["public-site"]).contains("gunnar-public-site"));
}