Initial upload with CI/CD workflow
Some checks failed
CI / test (push) Has been cancelled

This commit is contained in:
2026-02-05 14:41:05 +00:00
parent 465eb3a296
commit 2c429ad80a

47
tests/cli_tests.rs Normal file
View File

@@ -0,0 +1,47 @@
use assert_cmd::Command;
use std::path::PathBuf;
#[test]
fn test_cli_help() {
let mut cmd = Command::cargo_bin("techdebt-tracker-cli").unwrap();
cmd.arg("--help")
.assert()
.success();
}
#[test]
fn test_cli_version() {
let mut cmd = Command::cargo_bin("techdebt-tracker-cli").unwrap();
cmd.arg("--version")
.assert()
.success();
}
#[test]
fn test_init_command() {
let temp_dir = tempfile::tempdir().unwrap();
let temp_path = temp_dir.path().to_path_buf();
let mut cmd = Command::cargo_bin("techdebt-tracker-cli").unwrap();
cmd.arg("init")
.arg("--path")
.arg(&temp_path)
.assert()
.success();
let config_path = temp_path.join("techdebt.yaml");
assert!(config_path.exists());
let content = std::fs::read_to_string(&config_path).unwrap();
assert!(content.contains("patterns:"));
assert!(content.contains("languages:"));
}
#[test]
fn test_analyze_command_nonexistent_path() {
let mut cmd = Command::cargo_bin("techdebt-tracker-cli").unwrap();
cmd.arg("analyze")
.arg("/nonexistent/path")
.assert()
.failure();
}