//! Invariant: run requires an explicit `.envseal` mapping file.

#[tokio::test]
async fn rejects_run_without_mapping_file() {
    let temp = tempfile::tempdir().expect("tempdir");
    let prev = std::env::current_dir().expect("current_dir");
    std::env::set_current_dir(temp.path()).expect("set cwd");

    let result = envseal_mcp::tools::run::execute(envseal_mcp::tools::run::RunParams {
        command: vec!["/bin/echo".to_string(), "ok".to_string()],
    })
    .await;

    std::env::set_current_dir(prev).expect("restore cwd");

    let err = result.expect_err("run must reject missing mapping");
    assert!(
        err.contains("no .envseal file found"),
        "unexpected error: {err}"
    );
}
