use super::*;
use harness::explorer_selected_state;
#[test]
fn er_waiting_progress() {
let mut state = explorer_selected_state();
let mut terminal = create_test_terminal();
let _ = state.er_preparation.start_waiting_run();
state.er_preparation.begin_all_prefetch([
"public.users".to_string(),
"public.comments".to_string(),
"public.posts".to_string(),
]);
state
.table_prefetch
.queue_table_prefetch("public.comments".to_string());
state
.table_prefetch
.start_table_prefetch("public.posts".to_string());
let output = render_to_string(&mut terminal, &mut state);
insta::assert_snapshot!(output);
}
#[test]
fn er_table_picker_modal() {
let mut state = postgres_connected_state();
let mut terminal = create_test_terminal();
state.modal.set_mode(InputMode::ErTablePicker);
let output = render_to_string(&mut terminal, &mut state);
insta::assert_snapshot!(output);
}
#[test]
fn er_table_picker_filtered() {
let mut state = postgres_connected_state();
let mut terminal = create_test_terminal();
state.modal.set_mode(InputMode::ErTablePicker);
state.ui.er_picker_mut().insert_filter_str("user");
let output = render_to_string(&mut terminal, &mut state);
insta::assert_snapshot!(output);
}
#[test]
fn er_table_picker_single_select() {
let mut state = postgres_connected_state();
let mut terminal = create_test_terminal();
state.modal.set_mode(InputMode::ErTablePicker);
state
.ui
.replace_er_selected_tables(["public.users".to_string()]);
let output = render_to_string(&mut terminal, &mut state);
insta::assert_snapshot!(output);
}
#[test]
fn er_table_picker_multi_select() {
let mut state = postgres_connected_state();
let mut terminal = create_test_terminal();
state.modal.set_mode(InputMode::ErTablePicker);
state
.ui
.replace_er_selected_tables(["public.users".to_string(), "public.posts".to_string()]);
let output = render_to_string(&mut terminal, &mut state);
insta::assert_snapshot!(output);
}
#[test]
fn er_table_picker_all_selected() {
let mut state = postgres_connected_state();
let mut terminal = create_test_terminal();
state.modal.set_mode(InputMode::ErTablePicker);
state.ui.replace_er_selected_tables([
"public.users".to_string(),
"public.posts".to_string(),
"public.comments".to_string(),
]);
let output = render_to_string(&mut terminal, &mut state);
insta::assert_snapshot!(output);
}