eazygit 0.5.1

A fast TUI for Git with staging, conflicts, rebase, and palette-first UX
Documentation
// Test utilities for command testing

use crate::commands::Command;
use crate::services::GitService;
use crate::app::AppState;
use std::sync::Arc;

/// Create a mock GitService for command testing
pub fn create_mock_git_service() -> Arc<GitService> {
    Arc::new(GitService::new())
}

/// Create a minimal AppState for command testing
pub fn create_test_state() -> AppState {
    let mut state = AppState::new();
    state.repo_path = "/tmp/test-repo".to_string();
    state
}

/// Helper to test command execution
pub fn test_command_execution<T: Command>(
    command: &T,
    git_service: &GitService,
    state: &AppState,
) -> Result<crate::commands::CommandResult, crate::errors::CommandError> {
    command.execute(git_service, state)
}

#[cfg(test)]
mod tests {
    use super::*;
    use crate::commands::{StageFilesCommand, UnstageFilesCommand};

    #[test]
    fn test_stage_files_command_creation() {
        let command = StageFilesCommand {
            paths: vec!["test.txt".to_string()],
        };
        let git_service = create_mock_git_service();
        let state = create_test_state();
        
        // Note: This will fail if git repo doesn't exist, but tests structure
        let _result = test_command_execution(&command, &git_service, &state);
    }

    #[test]
    fn test_unstage_files_command_creation() {
        let command = UnstageFilesCommand {
            paths: vec!["test.txt".to_string()],
        };
        let git_service = create_mock_git_service();
        let state = create_test_state();
        
        // Note: This will fail if git repo doesn't exist, but tests structure
        let _result = test_command_execution(&command, &git_service, &state);
    }
}