mirror of
https://github.com/openai/codex.git
synced 2026-06-02 11:22:01 +00:00
test: cover standalone update notice in standard tests
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
---
|
||||
source: tui/src/history_cell/tests.rs
|
||||
expression: rendered
|
||||
---
|
||||
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
|
||||
│ ✨ Update available! 0.0.0 -> 9.9.9 │
|
||||
│ Run powershell -ExecutionPolicy Bypass -c '$env:CODEX_NON_INTERACTIVE=1; irm https://chatgpt.com/codex/install.ps1 | iex' to update. │
|
||||
│ │
|
||||
│ See full release notes: │
|
||||
│ https://github.com/openai/codex/releases/latest │
|
||||
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
|
||||
@@ -1027,6 +1027,15 @@ fn web_search_history_cell_snapshot() {
|
||||
insta::assert_snapshot!(rendered);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn standalone_windows_update_available_history_cell_snapshot() {
|
||||
let cell =
|
||||
UpdateAvailableHistoryCell::new("9.9.9".to_string(), Some(UpdateAction::StandaloneWindows));
|
||||
let rendered = render_lines(&cell.display_lines(/*width*/ 110)).join("\n");
|
||||
|
||||
insta::assert_snapshot!(rendered);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn web_search_history_cell_wraps_with_indented_continuation() {
|
||||
let query = "example search query with several generic words to exercise wrapping".to_string();
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
---
|
||||
source: tui/src/update_prompt.rs
|
||||
expression: terminal.backend()
|
||||
---
|
||||
|
||||
✨ Update available! 0.0.0 -> 9.9.9
|
||||
|
||||
Release notes: https://github.com/openai/codex/releases/latest
|
||||
|
||||
› 1. Update now (runs `powershell -ExecutionPolicy Bypass -c '$env:CODEX_NON_INTERACTIVE=1; irm
|
||||
https://chatgpt.com/codex/install.ps1 | iex'`)
|
||||
2. Skip
|
||||
3. Skip until next version
|
||||
|
||||
Press enter to continue
|
||||
@@ -250,11 +250,11 @@ mod tests {
|
||||
use ratatui::Terminal;
|
||||
|
||||
fn new_prompt() -> UpdatePromptScreen {
|
||||
prompt_for_action(UpdateAction::NpmGlobalLatest)
|
||||
}
|
||||
|
||||
fn prompt_for_action(update_action: UpdateAction) -> UpdatePromptScreen {
|
||||
UpdatePromptScreen::new(FrameRequester::test_dummy(), "9.9.9".into(), update_action)
|
||||
UpdatePromptScreen::new(
|
||||
FrameRequester::test_dummy(),
|
||||
"9.9.9".into(),
|
||||
UpdateAction::NpmGlobalLatest,
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -267,16 +267,6 @@ mod tests {
|
||||
insta::assert_snapshot!("update_prompt_modal", terminal.backend());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn standalone_windows_update_prompt_snapshot() {
|
||||
let screen = prompt_for_action(UpdateAction::StandaloneWindows);
|
||||
let mut terminal = Terminal::new(VT100Backend::new(110, 12)).expect("terminal");
|
||||
terminal
|
||||
.draw(|frame| frame.render_widget_ref(&screen, frame.area()))
|
||||
.expect("render update prompt");
|
||||
insta::assert_snapshot!("standalone_windows_update_prompt_modal", terminal.backend());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn update_prompt_confirm_selects_update() {
|
||||
let mut screen = new_prompt();
|
||||
|
||||
Reference in New Issue
Block a user