test(tui): pin model state in footer and picker tests

This commit is contained in:
Hunter Bown
2026-05-12 12:10:17 -05:00
parent 92fd81db4e
commit 136be0d255
2 changed files with 9 additions and 3 deletions
+5
View File
@@ -409,6 +409,7 @@ mod tests {
// pass-through providers (Ollama, OpenAI) hide the DeepSeek model
// rows and leave only `auto` + custom — Down has nowhere to go.
app.model = "deepseek-v4-pro".to_string();
app.auto_model = false;
app.reasoning_effort = ReasoningEffort::Max;
app.api_provider = crate::config::ApiProvider::Deepseek;
(app, lock)
@@ -418,6 +419,7 @@ mod tests {
fn picker_initial_selection_matches_app_state() {
let (mut app, _lock) = create_test_app();
app.model = "deepseek-v4-flash".to_string();
app.auto_model = false;
app.reasoning_effort = ReasoningEffort::Max;
let view = ModelPickerView::new(&app);
assert_eq!(view.resolved_model(), "deepseek-v4-flash");
@@ -459,6 +461,7 @@ mod tests {
fn picker_normalizes_low_medium_to_high() {
let (mut app, _lock) = create_test_app();
app.reasoning_effort = ReasoningEffort::Medium;
app.auto_model = false;
let view = ModelPickerView::new(&app);
assert_eq!(
view.resolved_effort(),
@@ -486,6 +489,7 @@ mod tests {
fn picker_preserves_unknown_model_via_custom_row() {
let (mut app, _lock) = create_test_app();
app.model = "deepseek-v4-pro-2026-04-XX".to_string();
app.auto_model = false;
let view = ModelPickerView::new(&app);
assert!(view.show_custom_model_row);
assert_eq!(view.resolved_model(), "deepseek-v4-pro-2026-04-XX");
@@ -533,6 +537,7 @@ mod tests {
fn enter_emits_apply_event_with_selection() {
let (mut app, _lock) = create_test_app();
app.reasoning_effort = ReasoningEffort::High;
app.auto_model = false;
let mut view = ModelPickerView::new(&app);
view.handle_key(KeyEvent::new(
KeyCode::Tab,
+4 -3
View File
@@ -668,10 +668,11 @@ mod tests {
initial_input: None,
};
let mut app = App::new(options, &Config::default());
// App::new may pick up `default_model` from a local user Settings
// file, which overrides the option above. Pin the model explicitly
// so these tests are independent of any host-side configuration.
// App::new may pick up local Settings, which override the option
// above. Pin model state explicitly so these tests are host-neutral.
app.model = "deepseek-v4-flash".to_string();
app.auto_model = false;
app.api_provider = crate::config::ApiProvider::Deepseek;
app
}