eazygit 0.5.1

A fast TUI for Git with staging, conflicts, rebase, and palette-first UX
Documentation
use crate::app::{Action, AppState};
use super::mapper::action_to_command;



#[test]
fn test_mapper_start_commit() {
    let mut state = AppState::new();
    state.commit_mode = true;
    state.amend_mode = false;
    state.commit_input = "test commit".to_string();
    state.amend_author_name = "Author".to_string();
    state.amend_author_email = "email@example.com".to_string();
    
    // Action::CommitSubmit maps to CommitCommand
    let cmd = action_to_command(&state, &Action::CommitSubmit);
    
    assert!(cmd.is_some());
    // We can't easily downcast generic Command trait object to check types in Rust without Any, 
    // but existence proves mapping occurred. 
    // Ideally we'd verify the command type, but for now verifying it's not None is a good start.
}

#[test]
fn test_mapper_push() {
    let state = AppState::new();
    let cmd = action_to_command(&state, &Action::Push);
    assert!(cmd.is_some());
}

#[test]
fn test_mapper_ignore_ui_actions() {
    let state = AppState::new();
    // UI-only actions shouldn't return a command
    let cmd = action_to_command(&state, &Action::FocusNext);
    assert!(cmd.is_none());
}

#[test]
fn test_mapper_rebase_commands() {
    let state = AppState::new();

    // Test all new rebase commands are properly mapped
    let test_cases = vec![
        Action::RebaseSaveAndRun,
        Action::RebaseContinue,
        Action::RebaseSkip,
        Action::RebaseAbort,
        Action::RebaseResolveConflicts,
        Action::RebaseAbortFromConflict,
        Action::RebaseContinueInterrupted,
        Action::RebaseAbortInterrupted,
    ];

    for action in test_cases {
        let cmd = action_to_command(&state, &action);
        assert!(cmd.is_some(), "Action {:?} should map to a command", action);
    }
}