Rustelo/tests/cli/feature_commands.rs

69 lines
1.9 KiB
Rust
Raw Normal View History

2026-02-08 20:18:46 +00:00
//! CLI feature command tests
use anyhow::Result;
use std::process::Command;
#[test]
fn test_features_list_command() -> Result<()> {
let temp_project = crate::create_test_project()?;
let project_root = temp_project.path();
// Create mock registry
crate::helpers::create_mock_registry(project_root)?;
// Test CLI command (this would require building the CLI)
// For integration tests, we'd run the actual binary
// let output = Command::new("cargo")
// .args(["run", "--bin", "cargo-rustelo", "--", "features", "list"])
// .current_dir(project_root)
// .output()?;
// assert!(output.status.success());
// assert!(String::from_utf8_lossy(&output.stdout).contains("test-analytics"));
Ok(())
}
#[test]
fn test_feature_add_command() -> Result<()> {
let temp_project = crate::create_test_project()?;
let project_root = temp_project.path();
// Create test feature
let test_feature = crate::helpers::TestFeatureBuilder::new("test-feature")
.with_dependency("serde")
.with_env_var("TEST_VAR", "default", false);
test_feature.create_in_project(project_root)?;
// Test feature add command
// This would run: cargo rustelo features add test-feature
Ok(())
}
#[test]
fn test_feature_remove_command() -> Result<()> {
let temp_project = crate::create_test_project()?;
let project_root = temp_project.path();
// First add a feature
let test_feature = crate::helpers::TestFeatureBuilder::new("removable");
test_feature.create_in_project(project_root)?;
// Then test removal
// This would run: cargo rustelo features remove removable
Ok(())
}
#[test]
fn test_feature_status_command() -> Result<()> {
let temp_project = crate::create_test_project()?;
let project_root = temp_project.path();
// Test status command
// This would run: cargo rustelo features status
Ok(())
}