test: cover standalone update notice in standard tests

This commit is contained in:
Edward Frazer
2026-05-26 16:17:22 -07:00
parent fd8c8791e1
commit 1706ee2d01
4 changed files with 25 additions and 30 deletions

View File

@@ -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 │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

View File

@@ -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();

View File

@@ -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

View File

@@ -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();