mirror of
https://github.com/openai/codex.git
synced 2026-11-24 07:20:27 +00:00
Group external agent config migration into a module (#35992)
## What changed - Move the migration flow, model, and source picker under the `external_agent_config_migration` module. - Keep their tests and snapshots alongside the corresponding module files and update imports and snapshot source paths. GitOrigin-RevId: 4b2f83ca689534e4d9cd1dc7aaa8424e76166bba
This commit is contained in:
1 parent
1da9f846b3
commit
f9b18d04ba
18 files changed
+31
-29
No files matched your search
@@ -0,0 +1,43 @@
|
||||
use super::*;
|
||||
use crate::test_backend::VT100Backend;
|
||||
use crossterm::event::KeyEvent;
|
||||
use crossterm::event::KeyModifiers;
|
||||
use pretty_assertions::assert_eq;
|
||||
use ratatui::Terminal;
|
||||
use ratatui::widgets::FrameExt;
|
||||
|
||||
fn new_screen() -> ExternalAgentConfigSourceScreen {
|
||||
ExternalAgentConfigSourceScreen::new(
|
||||
FrameRequester::test_dummy(),
|
||||
&ExternalAgentConfigMigrationSource::ALL,
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn external_agent_config_source_prompt_snapshot() {
|
||||
let screen = new_screen();
|
||||
let mut terminal =
|
||||
Terminal::new(VT100Backend::new(/*width*/ 80, /*height*/ 12)).expect("terminal");
|
||||
terminal
|
||||
.draw(|frame| frame.render_widget_ref(&screen, frame.area()))
|
||||
.expect("render source prompt");
|
||||
insta::assert_snapshot!("external_agent_config_source_prompt", terminal.backend());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn external_agent_config_source_prompt_selects_highlighted_source() {
|
||||
let mut screen = new_screen();
|
||||
screen.handle_key(KeyEvent::new(KeyCode::Down, KeyModifiers::NONE));
|
||||
screen.handle_key(KeyEvent::new(KeyCode::Enter, KeyModifiers::NONE));
|
||||
assert_eq!(
|
||||
screen.selection(),
|
||||
Some(ExternalAgentConfigMigrationSource::Cur)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn external_agent_config_source_prompt_can_cancel() {
|
||||
let mut screen = new_screen();
|
||||
screen.handle_key(KeyEvent::new(KeyCode::Esc, KeyModifiers::NONE));
|
||||
assert_eq!(screen.selection(), None);
|
||||
}
|
||||
Reference in new issue
Block a user