refactor(cli): simplify keypress and mouse providers and update tests (#22853)

This commit is contained in:
Tommaso Sciortino
2026-03-18 16:38:56 +00:00
committed by GitHub
parent 81a97e78f1
commit d7dfcf7f99
40 changed files with 923 additions and 863 deletions

View File

@@ -6,10 +6,11 @@
import { describe, expect, it, vi } from 'vitest';
import { getToolGroupBorderAppearance } from './borderStyles.js';
import { CoreToolCallStatus } from '@google/gemini-cli-core';
import { CoreToolCallStatus, makeFakeConfig } from '@google/gemini-cli-core';
import { theme } from '../semantic-colors.js';
import type { IndividualToolCallDisplay } from '../types.js';
import { renderWithProviders } from '../../test-utils/render.js';
import { createMockSettings } from '../../test-utils/settings.js';
import { MainContent } from '../components/MainContent.js';
import { Text } from 'ink';
@@ -17,6 +18,13 @@ vi.mock('../components/CliSpinner.js', () => ({
CliSpinner: () => <Text></Text>,
}));
const altBufferOptions = {
config: makeFakeConfig({ useAlternateBuffer: true }),
settings: createMockSettings({
merged: { ui: { useAlternateBuffer: true } },
}),
};
describe('getToolGroupBorderAppearance', () => {
it('should use warning color for pending non-shell tools', () => {
const item = {
@@ -105,6 +113,7 @@ describe('getToolGroupBorderAppearance', () => {
describe('MainContent tool group border SVG snapshots', () => {
it('should render SVG snapshot for a pending search dialog (google_web_search)', async () => {
const renderResult = renderWithProviders(<MainContent />, {
...altBufferOptions,
uiState: {
history: [],
pendingHistoryItems: [
@@ -129,6 +138,7 @@ describe('MainContent tool group border SVG snapshots', () => {
it('should render SVG snapshot for an empty slice following a search tool', async () => {
const renderResult = renderWithProviders(<MainContent />, {
...altBufferOptions,
uiState: {
history: [],
pendingHistoryItems: [
@@ -157,6 +167,7 @@ describe('MainContent tool group border SVG snapshots', () => {
it('should render SVG snapshot for a shell tool', async () => {
const renderResult = renderWithProviders(<MainContent />, {
...altBufferOptions,
uiState: {
history: [],
pendingHistoryItems: [