#![allow(dead_code)]
use assert_cmd::Command;
use std::path::PathBuf;
use tempfile::TempDir;
pub fn sgr_cmd() -> Command {
let mock_dir = common::mock_llm_path();
let mut c = Command::cargo_bin("sqlite-graphrag").expect("sqlite-graphrag binary not found");
c.env("PATH", common::prepend_path(&mock_dir));
c
}
#[path = "../common/mod.rs"]
pub mod common;
pub fn cmd_base(tmp: &TempDir) -> Command {
let mut c = sgr_cmd();
common::wire_assert_cmd(tmp, &mut c, "test.sqlite");
c.arg("--lang").arg("en");
c.arg("--skip-memory-guard");
c
}
pub fn init_db(tmp: &TempDir) {
cmd_base(tmp).arg("init").assert().success();
}
pub fn remember_ok(tmp: &TempDir, name: &str, body: &str) {
cmd_base(tmp)
.args([
"remember",
"--name",
name,
"--type",
"user",
"--description",
"desc for prd test",
"--namespace",
"global",
"--body",
body,
"--skip-extraction",
])
.assert()
.success();
}
pub fn db_path(tmp: &TempDir) -> PathBuf {
tmp.path().join("test.sqlite")
}