use assert_cmd::Command;
use predicates::prelude::*;
use std::fs;
use tempfile::tempdir;
#[allow(deprecated)]
fn toon_lsp() -> Command {
Command::cargo_bin("toon-lsp").expect("should build binary")
}
#[test]
fn test_graph_simple_dependency() {
let temp = tempdir().expect("create temp dir");
let toon_path = temp.path().join("dependency.toon");
fs::write(&toon_path, "db:\n port: 5432\nconnection:\n url: ${db.port}\n")
.expect("write file");
let mut cmd = toon_lsp();
cmd.arg("graph").arg(&toon_path);
cmd.assert()
.success()
.stdout(predicate::str::contains("flowchart TD"))
.stdout(predicate::str::contains("db.port"))
.stdout(predicate::str::contains("connection.url"))
.stdout(predicate::str::contains("-->"));
}