initial skeleton

This commit is contained in:
stoorps 2026-03-19 18:46:50 +00:00
parent dc79fa2448
commit 71f89dde9c
Signed by: stoorps
SSH key fingerprint: SHA256:AZlPfu9hTu042EGtZElmDQoy+KvMOeShLDan/fYLoNI
60 changed files with 3480 additions and 0 deletions

View file

@ -0,0 +1,13 @@
use assert_cmd::Command;
use predicates::str::contains;
#[test]
fn help_lists_expected_commands() {
let mut cmd = Command::cargo_bin("aim").unwrap();
cmd.arg("--help")
.assert()
.success()
.stdout(contains("remove"))
.stdout(contains("list"))
.stdout(contains("update"));
}

View file

@ -0,0 +1,7 @@
use assert_cmd::Command;
#[test]
fn cli_shows_help() {
let mut cmd = Command::cargo_bin("aim").unwrap();
cmd.arg("--help").assert().success();
}

View file

@ -0,0 +1,54 @@
use assert_cmd::Command;
use predicates::str::contains;
use tempfile::tempdir;
#[test]
fn list_command_runs_without_registry_entries() {
let mut cmd = Command::cargo_bin("aim").unwrap();
cmd.arg("list")
.assert()
.success()
.stdout(contains("installed"));
}
#[test]
fn list_command_reads_registered_apps_from_registry_file() {
let dir = tempdir().unwrap();
let registry_path = dir.path().join("registry.toml");
std::fs::write(
&registry_path,
"version = 1\n[[apps]]\nstable_id = \"bat\"\ndisplay_name = \"Bat\"\n",
)
.unwrap();
let mut cmd = Command::cargo_bin("aim").unwrap();
cmd.arg("list")
.env("AIM_REGISTRY_PATH", &registry_path)
.assert()
.success()
.stdout(contains("Bat (bat)"));
}
#[test]
fn remove_command_removes_registered_app_from_registry_file() {
let dir = tempdir().unwrap();
let registry_path = dir.path().join("registry.toml");
std::fs::write(
&registry_path,
"version = 1\n[[apps]]\nstable_id = \"bat\"\ndisplay_name = \"Bat\"\n",
)
.unwrap();
let mut cmd = Command::cargo_bin("aim").unwrap();
cmd.args(["remove", "bat"])
.env("AIM_REGISTRY_PATH", &registry_path)
.assert()
.success()
.stdout(contains("removed: Bat"));
let contents = std::fs::read_to_string(&registry_path).unwrap();
assert!(!contents.contains("stable_id = \"bat\""));
}

View file

@ -0,0 +1,7 @@
use aim_cli::ui::render::render_update_summary;
#[test]
fn update_summary_mentions_selected_count() {
let output = render_update_summary(3, 2, 1);
assert!(output.contains("selected: 2"));
}