Improve test coverage for cli/src/ui/components (#13598)

This commit is contained in:
Megha Bansal
2025-11-22 08:17:29 +05:30
committed by GitHub
parent bdf80ea7c0
commit e205a468d9
48 changed files with 2897 additions and 51 deletions
@@ -0,0 +1,20 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`Banner > handles newlines in text 1`] = `
"╭──────────────────────────────────────────────────────────────────────────────╮
│ Line 1 │
│ Line 2 │
╰──────────────────────────────────────────────────────────────────────────────╯"
`;
exports[`Banner > renders in info mode 1`] = `
"╭──────────────────────────────────────────────────────────────────────────────╮
│ Info Message │
╰──────────────────────────────────────────────────────────────────────────────╯"
`;
exports[`Banner > renders in warning mode 1`] = `
"╭──────────────────────────────────────────────────────────────────────────────╮
│ Warning Message │
╰──────────────────────────────────────────────────────────────────────────────╯"
`;
@@ -0,0 +1,16 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`ConfigInitDisplay > handles empty clients map 1`] = `
"
Spinner Initializing..."
`;
exports[`ConfigInitDisplay > renders initial state 1`] = `
"
Spinner Initializing..."
`;
exports[`ConfigInitDisplay > updates message on McpClientUpdate event 1`] = `
"
Spinner Connecting to MCP servers... (1/2)"
`;
@@ -0,0 +1,18 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`EditorSettingsDialog > renders correctly 1`] = `
"╭──────────────────────────────────────────────────────────────────────────────────────────────────╮
│ │
│ > Select Editor Editor Preference │
│ ● 1. VS Code │
│ 2. Vim These editors are currently supported. Please note │
│ that some editors cannot be used in sandbox mode. │
│ Apply To │
│ ● 1. User Settings Your preferred editor is: None. │
│ 2. Workspace Settings │
│ │
│ (Use Enter to select, Tab to change │
│ focus, Esc to close) │
│ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯"
`;
@@ -0,0 +1,22 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`Notifications > renders init error 1`] = `
"╭──────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Initialization Error: Something went wrong Please check API key and configuration. │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
"
`;
exports[`Notifications > renders screen reader nudge when enabled and not seen 1`] = `
"You are currently in screen reader-friendly view. To switch out, open
/mock/home/.gemini/settings.json and remove the entry for "screenReader". This will disappear on
next run."
`;
exports[`Notifications > renders update notification 1`] = `
"
╭──────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Update available │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
"
`;
@@ -0,0 +1,32 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`SessionBrowser component > enters search mode, filters sessions, and renders match snippets 1`] = `
" Chat Sessions (1 total, filtered) sorted by date desc
Search: query (Esc to cancel)
Index │ Msgs │ Age │ Match
#1 │ 1 │ 10mo │ You: Query is here a… (+1 more)
▼"
`;
exports[`SessionBrowser component > renders a list of sessions and marks current session as disabled 1`] = `
" Chat Sessions (2 total) sorted by date desc
Navigate: ↑/↓ Resume: Enter Search: / Delete: x Quit: q
Sort: s Reverse: r First/Last: g/G
Index │ Msgs │ Age │ Name
#1 │ 5 │ 10mo │ Second conversation about dogs (current)
#2 │ 2 │ 10mo │ First conversation about cats
▼"
`;
exports[`SessionBrowser component > shows an error state when loading sessions fails 1`] = `
" Error: storage failure
Press q to exit"
`;
exports[`SessionBrowser component > shows empty state when no sessions exist 1`] = `
" No auto-saved conversations found.
Press q to exit"
`;
@@ -0,0 +1,31 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`SuggestionsDisplay > handles scrolling 1`] = `
" ▲
Cmd 5 Description 5
Cmd 6 Description 6
Cmd 7 Description 7
Cmd 8 Description 8
Cmd 9 Description 9
Cmd 10 Description 10
Cmd 11 Description 11
Cmd 12 Description 12
(11/20)"
`;
exports[`SuggestionsDisplay > highlights active item 1`] = `
" command1 Description 1
command2 Description 2
command3 Description 3"
`;
exports[`SuggestionsDisplay > renders MCP tag for MCP prompts 1`] = `" mcp-tool [MCP]"`;
exports[`SuggestionsDisplay > renders loading state 1`] = `" Loading suggestions..."`;
exports[`SuggestionsDisplay > renders suggestions list 1`] = `
" command1 Description 1
command2 Description 2
command3 Description 3"
`;