use umbral_cli::{STANDALONE_COMMANDS, try_run_standalone};
#[test]
fn maskkeygen_runs_standalone_without_a_project() {
assert!(
STANDALONE_COMMANDS.contains(&"maskkeygen"),
"maskkeygen must be registered as a standalone command"
);
let handled = try_run_standalone(&["maskkeygen".to_string()]);
assert!(
handled.is_some(),
"maskkeygen must run standalone, not be forwarded to a project"
);
assert!(handled.unwrap().is_ok(), "maskkeygen succeeds");
}
#[test]
fn project_and_custom_commands_are_forwarded_not_run_standalone() {
for cmd in [
"migrate",
"serve",
"makemigrations",
"worker",
"squashmigrations",
] {
assert!(
try_run_standalone(&[cmd.to_string()]).is_none(),
"`{cmd}` needs the project and must forward, not run standalone"
);
}
assert!(
try_run_standalone(&[
"seed_data".to_string(),
"--count".to_string(),
"10".to_string()
])
.is_none(),
"a custom command like seed_data forwards to cargo run"
);
assert!(try_run_standalone(&[]).is_none());
}