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();
let cmd = action_to_command(&state, &Action::CommitSubmit);
assert!(cmd.is_some());
}
#[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();
let cmd = action_to_command(&state, &Action::FocusNext);
assert!(cmd.is_none());
}
#[test]
fn test_mapper_rebase_commands() {
let state = AppState::new();
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);
}
}