use zilliz::cli::quickstart::is_interactive;
const QUICKSTART_SRC: &str = include_str!("../src/cli/quickstart.rs");
#[test]
fn cheatsheet_uses_only_placeholders() {
let src = QUICKSTART_SRC;
let start = src
.find("fn print_cheatsheet")
.expect("print_cheatsheet defined");
let end = src[start..]
.find("// Helpers")
.expect("cheatsheet ends before Helpers section")
+ start;
let body = &src[start..end];
assert!(
body.contains("<clusterId>"),
"expected <clusterId> placeholder"
);
assert!(body.contains("<orgId>"), "expected <orgId> placeholder");
assert!(
!body.contains("in01-") && !body.contains("in05-"),
"cheatsheet must not contain real cluster ID prefixes (in01-/in05-)"
);
assert!(
!body.contains("org-"),
"cheatsheet must not contain real org ID prefix (org-)"
);
}
#[test]
fn non_interactive_when_flag_set() {
assert!(!is_interactive(true));
}
#[test]
fn cheatsheet_contains_required_sections() {
let src = QUICKSTART_SRC;
for header in [
"Authentication:",
"Context:",
"Clusters:",
"Collections & Vectors:",
"Output formatting:",
"Help:",
] {
assert!(
src.contains(header),
"cheatsheet missing section header: {}",
header
);
}
}