#![cfg(feature = "slow-tests")]
#[path = "smoke_support/mod.rs"]
mod support;
use support::{assert_json_or_not_found, assert_json_stdout, Env};
#[test]
#[ignore = "needs `cargo install --path .` first: validates the INSTALLED binary, not this build"]
fn smoke_13_hybrid_search() {
let env = Env::new();
env.init();
env.remember(
"smoke-hybrid-01",
"conteúdo para busca híbrida com FTS e vetorial",
);
let out = env
.cmd()
.args(["hybrid-search", "busca híbrida", "-k", "5"])
.output()
.expect("hybrid-search failed");
assert_json_or_not_found(&out);
}
#[test]
#[ignore = "needs `cargo install --path .` first: validates the INSTALLED binary, not this build"]
fn smoke_14_stats() {
let env = Env::new();
env.init();
let out = env.cmd().arg("stats").output().expect("stats failed");
assert_json_stdout(&out);
let json: serde_json::Value = serde_json::from_slice(&out.stdout).unwrap();
assert!(
json["memories"].as_i64().is_some(),
"stats deve ter campo memories como inteiro: {json}"
);
}
#[test]
#[ignore = "needs `cargo install --path .` first: validates the INSTALLED binary, not this build"]
fn smoke_15_migrate() {
let env = Env::new();
env.init();
let out = env.cmd().arg("migrate").output().expect("migrate failed");
assert_json_stdout(&out);
let json: serde_json::Value = serde_json::from_slice(&out.stdout).unwrap();
assert_eq!(
json["status"], "ok",
"migrate deve retornar status=ok: {json}"
);
}
#[test]
#[ignore = "needs `cargo install --path .` first: validates the INSTALLED binary, not this build"]
fn smoke_16_namespace_detect() {
let env = Env::new();
env.init();
let out = env
.cmd()
.arg("namespace-detect")
.output()
.expect("namespace-detect failed");
assert_json_stdout(&out);
let json: serde_json::Value = serde_json::from_slice(&out.stdout).unwrap();
assert!(
json["namespace"].is_string(),
"namespace-detect deve retornar campo namespace: {json}"
);
}
#[test]
#[ignore = "needs `cargo install --path .` first: validates the INSTALLED binary, not this build"]
fn smoke_17_optimize() {
let env = Env::new();
env.init();
let out = env.cmd().arg("optimize").output().expect("optimize failed");
assert_json_stdout(&out);
}
#[test]
#[ignore = "needs `cargo install --path .` first: validates the INSTALLED binary, not this build"]
fn smoke_18_sync_safe_copy() {
let env = Env::new();
env.init();
let dest = env.tmp.path().join("snapshot.sqlite");
let out = env
.cmd()
.args(["sync-safe-copy", "--dest", dest.to_str().unwrap()])
.output()
.expect("sync-safe-copy failed");
assert_json_stdout(&out);
assert!(dest.exists(), "snapshot deve ter sido criado em {dest:?}");
}
#[test]
#[ignore = "needs `cargo install --path .` first: validates the INSTALLED binary, not this build"]
fn smoke_19_vacuum() {
let env = Env::new();
env.init();
let out = env.cmd().arg("vacuum").output().expect("vacuum failed");
assert_json_stdout(&out);
}