feat:(first commit)created repository and complete 0.1.0
This commit is contained in:
64
tests/integration_tests.rs
Normal file
64
tests/integration_tests.rs
Normal file
@@ -0,0 +1,64 @@
|
||||
use assert_cmd::Command;
|
||||
use predicates::prelude::*;
|
||||
use std::fs;
|
||||
use tempfile::TempDir;
|
||||
|
||||
#[test]
|
||||
fn test_cli_help() {
|
||||
let mut cmd = Command::cargo_bin("quicommit").unwrap();
|
||||
cmd.arg("--help");
|
||||
cmd.assert()
|
||||
.success()
|
||||
.stdout(predicate::str::contains("QuicCommit"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_version() {
|
||||
let mut cmd = Command::cargo_bin("quicommit").unwrap();
|
||||
cmd.arg("--version");
|
||||
cmd.assert()
|
||||
.success()
|
||||
.stdout(predicate::str::contains("0.1.0"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_config_show() {
|
||||
let temp_dir = TempDir::new().unwrap();
|
||||
let config_dir = temp_dir.path().join("config");
|
||||
fs::create_dir(&config_dir).unwrap();
|
||||
|
||||
let mut cmd = Command::cargo_bin("quicommit").unwrap();
|
||||
cmd.env("QUICOMMIT_CONFIG", config_dir.join("config.toml"))
|
||||
.arg("config")
|
||||
.arg("show");
|
||||
|
||||
cmd.assert().success();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_profile_list_empty() {
|
||||
let temp_dir = TempDir::new().unwrap();
|
||||
|
||||
let mut cmd = Command::cargo_bin("quicommit").unwrap();
|
||||
cmd.env("QUICOMMIT_CONFIG", temp_dir.path().join("config.toml"))
|
||||
.arg("profile")
|
||||
.arg("list");
|
||||
|
||||
cmd.assert()
|
||||
.success()
|
||||
.stdout(predicate::str::contains("No profiles configured"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_init_quick() {
|
||||
let temp_dir = TempDir::new().unwrap();
|
||||
|
||||
let mut cmd = Command::cargo_bin("quicommit").unwrap();
|
||||
cmd.env("QUICOMMIT_CONFIG", temp_dir.path().join("config.toml"))
|
||||
.arg("init")
|
||||
.arg("--yes");
|
||||
|
||||
cmd.assert()
|
||||
.success()
|
||||
.stdout(predicate::str::contains("initialized successfully"));
|
||||
}
|
||||
Reference in New Issue
Block a user