refactor(cli): integrate real config loading into async test utils (#23040)

This commit is contained in:
Tommaso Sciortino
2026-03-19 17:05:33 +00:00
committed by GitHub
parent 7de0616229
commit 23264ced9a
103 changed files with 1806 additions and 1541 deletions

View File

@@ -29,7 +29,7 @@ describe('<CompressionMessage />', () => {
describe('pending state', () => {
it('renders pending message when compression is in progress', async () => {
const props = createCompressionProps({ isPending: true });
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<CompressionMessage {...props} />,
);
await waitUntilReady();
@@ -48,7 +48,7 @@ describe('<CompressionMessage />', () => {
newTokenCount: 50,
compressionStatus: CompressionStatus.COMPRESSED,
});
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<CompressionMessage {...props} />,
);
await waitUntilReady();
@@ -73,9 +73,8 @@ describe('<CompressionMessage />', () => {
newTokenCount: newTokens,
compressionStatus: CompressionStatus.COMPRESSED,
});
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
<CompressionMessage {...props} />,
);
const { lastFrame, waitUntilReady, unmount } =
await renderWithProviders(<CompressionMessage {...props} />);
await waitUntilReady();
const output = lastFrame();
@@ -99,7 +98,7 @@ describe('<CompressionMessage />', () => {
compressionStatus:
CompressionStatus.COMPRESSION_FAILED_INFLATED_TOKEN_COUNT,
});
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<CompressionMessage {...props} />,
);
await waitUntilReady();
@@ -120,7 +119,7 @@ describe('<CompressionMessage />', () => {
compressionStatus:
CompressionStatus.COMPRESSION_FAILED_INFLATED_TOKEN_COUNT,
});
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<CompressionMessage {...props} />,
);
await waitUntilReady();
@@ -159,9 +158,8 @@ describe('<CompressionMessage />', () => {
newTokenCount: newTokens,
compressionStatus: CompressionStatus.COMPRESSED,
});
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
<CompressionMessage {...props} />,
);
const { lastFrame, waitUntilReady, unmount } =
await renderWithProviders(<CompressionMessage {...props} />);
await waitUntilReady();
const output = lastFrame();
@@ -184,9 +182,8 @@ describe('<CompressionMessage />', () => {
compressionStatus:
CompressionStatus.COMPRESSION_FAILED_INFLATED_TOKEN_COUNT,
});
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
<CompressionMessage {...props} />,
);
const { lastFrame, waitUntilReady, unmount } =
await renderWithProviders(<CompressionMessage {...props} />);
await waitUntilReady();
const output = lastFrame();
@@ -212,9 +209,8 @@ describe('<CompressionMessage />', () => {
compressionStatus:
CompressionStatus.COMPRESSION_FAILED_INFLATED_TOKEN_COUNT,
});
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
<CompressionMessage {...props} />,
);
const { lastFrame, waitUntilReady, unmount } =
await renderWithProviders(<CompressionMessage {...props} />);
await waitUntilReady();
const output = lastFrame();
@@ -232,7 +228,7 @@ describe('<CompressionMessage />', () => {
isPending: false,
compressionStatus: CompressionStatus.COMPRESSION_FAILED_EMPTY_SUMMARY,
});
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<CompressionMessage {...props} />,
);
await waitUntilReady();
@@ -251,7 +247,7 @@ describe('<CompressionMessage />', () => {
compressionStatus:
CompressionStatus.COMPRESSION_FAILED_TOKEN_COUNT_ERROR,
});
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<CompressionMessage {...props} />,
);
await waitUntilReady();

View File

@@ -7,7 +7,6 @@
import { OverflowProvider } from '../../contexts/OverflowContext.js';
import { renderWithProviders } from '../../../test-utils/render.js';
import { createMockSettings } from '../../../test-utils/settings.js';
import { makeFakeConfig } from '@google/gemini-cli-core';
import { waitFor } from '../../../test-utils/async.js';
import { DiffRenderer } from './DiffRenderer.js';
import * as CodeColorizer from '../../utils/CodeColorizer.js';
@@ -36,7 +35,7 @@ index 0000000..e69de29
@@ -0,0 +1 @@
+print("hello world")
`;
renderWithProviders(
await renderWithProviders(
<OverflowProvider>
<DiffRenderer
diffContent={newFileDiffContent}
@@ -45,7 +44,6 @@ index 0000000..e69de29
/>
</OverflowProvider>,
{
config: makeFakeConfig({ useAlternateBuffer }),
settings: createMockSettings({ ui: { useAlternateBuffer } }),
},
);
@@ -71,7 +69,7 @@ index 0000000..e69de29
@@ -0,0 +1 @@
+some content
`;
renderWithProviders(
await renderWithProviders(
<OverflowProvider>
<DiffRenderer
diffContent={newFileDiffContent}
@@ -80,7 +78,6 @@ index 0000000..e69de29
/>
</OverflowProvider>,
{
config: makeFakeConfig({ useAlternateBuffer }),
settings: createMockSettings({ ui: { useAlternateBuffer } }),
},
);
@@ -106,12 +103,11 @@ index 0000000..e69de29
@@ -0,0 +1 @@
+some text content
`;
renderWithProviders(
await renderWithProviders(
<OverflowProvider>
<DiffRenderer diffContent={newFileDiffContent} terminalWidth={80} />
</OverflowProvider>,
{
config: makeFakeConfig({ useAlternateBuffer }),
settings: createMockSettings({ ui: { useAlternateBuffer } }),
},
);
@@ -138,7 +134,7 @@ index 0000001..0000002 100644
-old line
+new line
`;
const { lastFrame } = renderWithProviders(
const { lastFrame } = await renderWithProviders(
<OverflowProvider>
<DiffRenderer
diffContent={existingFileDiffContent}
@@ -147,7 +143,6 @@ index 0000001..0000002 100644
/>
</OverflowProvider>,
{
config: makeFakeConfig({ useAlternateBuffer }),
settings: createMockSettings({ ui: { useAlternateBuffer } }),
},
);
@@ -172,7 +167,7 @@ index 1234567..1234567 100644
--- a/file.txt
+++ b/file.txt
`;
const { lastFrame } = renderWithProviders(
const { lastFrame } = await renderWithProviders(
<OverflowProvider>
<DiffRenderer
diffContent={noChangeDiff}
@@ -181,7 +176,6 @@ index 1234567..1234567 100644
/>
</OverflowProvider>,
{
config: makeFakeConfig({ useAlternateBuffer }),
settings: createMockSettings({ ui: { useAlternateBuffer } }),
},
);
@@ -191,12 +185,11 @@ index 1234567..1234567 100644
});
it('should handle empty diff content', async () => {
const { lastFrame } = renderWithProviders(
const { lastFrame } = await renderWithProviders(
<OverflowProvider>
<DiffRenderer diffContent="" terminalWidth={80} />
</OverflowProvider>,
{
config: makeFakeConfig({ useAlternateBuffer }),
settings: createMockSettings({ ui: { useAlternateBuffer } }),
},
);
@@ -220,7 +213,7 @@ index 123..456 100644
context line 10
context line 11
`;
const { lastFrame } = renderWithProviders(
const { lastFrame } = await renderWithProviders(
<OverflowProvider>
<DiffRenderer
diffContent={diffWithGap}
@@ -229,7 +222,6 @@ index 123..456 100644
/>
</OverflowProvider>,
{
config: makeFakeConfig({ useAlternateBuffer }),
settings: createMockSettings({ ui: { useAlternateBuffer } }),
},
);
@@ -257,7 +249,7 @@ index abc..def 100644
context line 14
context line 15
`;
const { lastFrame } = renderWithProviders(
const { lastFrame } = await renderWithProviders(
<OverflowProvider>
<DiffRenderer
diffContent={diffWithSmallGap}
@@ -266,7 +258,6 @@ index abc..def 100644
/>
</OverflowProvider>,
{
config: makeFakeConfig({ useAlternateBuffer }),
settings: createMockSettings({ ui: { useAlternateBuffer } }),
},
);
@@ -309,7 +300,7 @@ index 123..789 100644
])(
'with terminalWidth $terminalWidth and height $height',
async ({ terminalWidth, height }) => {
const { lastFrame } = renderWithProviders(
const { lastFrame } = await renderWithProviders(
<OverflowProvider>
<DiffRenderer
diffContent={diffWithMultipleHunks}
@@ -319,7 +310,6 @@ index 123..789 100644
/>
</OverflowProvider>,
{
config: makeFakeConfig({ useAlternateBuffer }),
settings: createMockSettings({ ui: { useAlternateBuffer } }),
},
);
@@ -347,7 +337,7 @@ fileDiff Index: file.txt
+const anotherNew = 'test';
\\ No newline at end of file
`;
const { lastFrame } = renderWithProviders(
const { lastFrame } = await renderWithProviders(
<OverflowProvider>
<DiffRenderer
diffContent={newFileDiff}
@@ -356,7 +346,6 @@ fileDiff Index: file.txt
/>
</OverflowProvider>,
{
config: makeFakeConfig({ useAlternateBuffer }),
settings: createMockSettings({ ui: { useAlternateBuffer } }),
},
);
@@ -377,7 +366,7 @@ fileDiff Index: Dockerfile
+RUN npm run build
\\ No newline at end of file
`;
const { lastFrame } = renderWithProviders(
const { lastFrame } = await renderWithProviders(
<OverflowProvider>
<DiffRenderer
diffContent={newFileDiff}
@@ -386,7 +375,6 @@ fileDiff Index: Dockerfile
/>
</OverflowProvider>,
{
config: makeFakeConfig({ useAlternateBuffer }),
settings: createMockSettings({ ui: { useAlternateBuffer } }),
},
);

View File

@@ -24,7 +24,7 @@ describe('<GeminiMessage /> - Raw Markdown Display Snapshots', () => {
])(
'renders with renderMarkdown=$renderMarkdown $description',
async ({ renderMarkdown }) => {
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<GeminiMessage {...baseProps} />,
{
uiState: { renderMarkdown, streamingState: StreamingState.Idle },
@@ -39,7 +39,7 @@ describe('<GeminiMessage /> - Raw Markdown Display Snapshots', () => {
it.each([{ renderMarkdown: true }, { renderMarkdown: false }])(
'renders pending state with renderMarkdown=$renderMarkdown',
async ({ renderMarkdown }) => {
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<GeminiMessage {...baseProps} isPending={true} />,
{
uiState: { renderMarkdown, streamingState: StreamingState.Idle },
@@ -55,7 +55,7 @@ describe('<GeminiMessage /> - Raw Markdown Display Snapshots', () => {
const terminalWidth = 20;
const text =
'This is a long line that should wrap correctly without truncation';
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<GeminiMessage
text={text}
isPending={false}

View File

@@ -33,7 +33,7 @@ describe('ToolConfirmationMessage Redirection', () => {
rootCommands: ['echo'],
};
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<ToolConfirmationMessage
callId="test-call-id"
confirmationDetails={confirmationDetails}

View File

@@ -59,7 +59,7 @@ describe('<ShellToolMessage />', () => {
['SHELL_COMMAND_NAME', SHELL_COMMAND_NAME],
['SHELL_TOOL_NAME', SHELL_TOOL_NAME],
])('clicks inside the shell area sets focus for %s', async (_, name) => {
const { lastFrame, simulateClick, unmount } = renderWithProviders(
const { lastFrame, simulateClick, unmount } = await renderWithProviders(
<ShellToolMessage {...baseProps} name={name} />,
{ uiActions, mouseEventsEnabled: true },
);
@@ -86,7 +86,7 @@ describe('<ShellToolMessage />', () => {
return <ShellToolMessage {...baseProps} status={status} ptyId={1} />;
};
const { lastFrame, unmount } = renderWithProviders(<Wrapper />, {
const { lastFrame, unmount } = await renderWithProviders(<Wrapper />, {
uiActions,
uiState: {
streamingState: StreamingState.Idle,
@@ -170,7 +170,7 @@ describe('<ShellToolMessage />', () => {
},
],
])('%s', async (_, props, options) => {
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<ShellToolMessage {...baseProps} {...props} />,
{ uiActions, ...options },
);
@@ -219,26 +219,29 @@ describe('<ShellToolMessage />', () => {
focused,
constrainHeight,
) => {
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
<ShellToolMessage
{...baseProps}
resultDisplay={LONG_OUTPUT}
renderOutputAsMarkdown={false}
availableTerminalHeight={availableTerminalHeight}
ptyId={1}
status={CoreToolCallStatus.Executing}
/>,
{
uiActions,
config: makeFakeConfig({ useAlternateBuffer: true }),
settings: createMockSettings({ ui: { useAlternateBuffer: true } }),
uiState: {
activePtyId: focused ? 1 : 2,
embeddedShellFocused: focused,
constrainHeight,
const { lastFrame, waitUntilReady, unmount } =
await renderWithProviders(
<ShellToolMessage
{...baseProps}
resultDisplay={LONG_OUTPUT}
renderOutputAsMarkdown={false}
availableTerminalHeight={availableTerminalHeight}
ptyId={1}
status={CoreToolCallStatus.Executing}
/>,
{
uiActions,
config: makeFakeConfig({ useAlternateBuffer: true }),
settings: createMockSettings({
ui: { useAlternateBuffer: true },
}),
uiState: {
activePtyId: focused ? 1 : 2,
embeddedShellFocused: focused,
constrainHeight,
},
},
},
);
);
await waitUntilReady();
const frame = lastFrame();
@@ -249,7 +252,7 @@ describe('<ShellToolMessage />', () => {
);
it('fully expands in standard mode when availableTerminalHeight is undefined', async () => {
const { lastFrame, unmount } = renderWithProviders(
const { lastFrame, unmount } = await renderWithProviders(
<ShellToolMessage
{...baseProps}
resultDisplay={LONG_OUTPUT}
@@ -273,7 +276,7 @@ describe('<ShellToolMessage />', () => {
});
it('fully expands in alternate buffer mode when constrainHeight is false and isExpandable is true', async () => {
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<ShellToolMessage
{...baseProps}
resultDisplay={LONG_OUTPUT}
@@ -303,7 +306,7 @@ describe('<ShellToolMessage />', () => {
});
it('stays constrained in alternate buffer mode when isExpandable is false even if constrainHeight is false', async () => {
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<ShellToolMessage
{...baseProps}
resultDisplay={LONG_OUTPUT}

View File

@@ -64,7 +64,7 @@ describe('<SubagentGroupDisplay />', () => {
},
];
const renderSubagentGroup = (
const renderSubagentGroup = async (
toolCallsToRender: IndividualToolCallDisplay[],
height?: number,
) =>
@@ -78,12 +78,12 @@ describe('<SubagentGroupDisplay />', () => {
);
it('renders nothing if there are no agent tool calls', async () => {
const { lastFrame } = renderSubagentGroup([], 40);
const { lastFrame } = await renderSubagentGroup([], 40);
expect(lastFrame({ allowEmpty: true })).toBe('');
});
it('renders collapsed view by default with correct agent counts and states', async () => {
const { lastFrame, waitUntilReady } = renderSubagentGroup(
const { lastFrame, waitUntilReady } = await renderSubagentGroup(
mockToolCalls,
40,
);
@@ -92,7 +92,10 @@ describe('<SubagentGroupDisplay />', () => {
});
it('expands when availableTerminalHeight is undefined', async () => {
const { lastFrame, rerender } = renderSubagentGroup(mockToolCalls, 40);
const { lastFrame, rerender } = await renderSubagentGroup(
mockToolCalls,
40,
);
// Default collapsed view
await waitFor(() => {

View File

@@ -11,7 +11,7 @@ import React from 'react';
describe('ThinkingMessage', () => {
it('renders subject line with vertical rule and "Thinking..." header', async () => {
const renderResult = renderWithProviders(
const renderResult = await renderWithProviders(
<ThinkingMessage
thought={{ subject: 'Planning', description: 'test' }}
terminalWidth={80}
@@ -30,7 +30,7 @@ describe('ThinkingMessage', () => {
});
it('uses description when subject is empty', async () => {
const renderResult = renderWithProviders(
const renderResult = await renderWithProviders(
<ThinkingMessage
thought={{ subject: '', description: 'Processing details' }}
terminalWidth={80}
@@ -48,7 +48,7 @@ describe('ThinkingMessage', () => {
});
it('renders full mode with left border and full text', async () => {
const renderResult = renderWithProviders(
const renderResult = await renderWithProviders(
<ThinkingMessage
thought={{
subject: 'Planning',
@@ -70,7 +70,7 @@ describe('ThinkingMessage', () => {
});
it('renders "Thinking..." header when isFirstThinking is true', async () => {
const renderResult = renderWithProviders(
const renderResult = await renderWithProviders(
<ThinkingMessage
thought={{
subject: 'Summary line',
@@ -92,7 +92,7 @@ describe('ThinkingMessage', () => {
});
it('normalizes escaped newline tokens', async () => {
const renderResult = renderWithProviders(
const renderResult = await renderWithProviders(
<ThinkingMessage
thought={{
subject: 'Matching the Blocks',
@@ -110,7 +110,7 @@ describe('ThinkingMessage', () => {
});
it('renders empty state gracefully', async () => {
const renderResult = renderWithProviders(
const renderResult = await renderWithProviders(
<ThinkingMessage
thought={{ subject: '', description: '' }}
terminalWidth={80}
@@ -124,7 +124,7 @@ describe('ThinkingMessage', () => {
});
it('renders multiple thinking messages sequentially correctly', async () => {
const renderResult = renderWithProviders(
const renderResult = await renderWithProviders(
<React.Fragment>
<ThinkingMessage
thought={{
@@ -161,7 +161,7 @@ describe('ThinkingMessage', () => {
});
it('filters out progress dots and empty lines', async () => {
const renderResult = renderWithProviders(
const renderResult = await renderWithProviders(
<ThinkingMessage
thought={{ subject: '...', description: 'Thinking\n.\n..\n...\nDone' }}
terminalWidth={80}

View File

@@ -50,7 +50,7 @@ describe('ToolConfirmationMessage', () => {
urls: ['https://example.com'],
};
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<ToolConfirmationMessage
callId="test-call-id"
confirmationDetails={confirmationDetails}
@@ -77,7 +77,7 @@ describe('ToolConfirmationMessage', () => {
],
};
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<ToolConfirmationMessage
callId="test-call-id"
confirmationDetails={confirmationDetails}
@@ -101,7 +101,7 @@ describe('ToolConfirmationMessage', () => {
urls: ['https://täst.com'],
};
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<ToolConfirmationMessage
callId="test-call-id"
confirmationDetails={confirmationDetails}
@@ -132,7 +132,7 @@ describe('ToolConfirmationMessage', () => {
rootCommands: ['curl'],
};
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<ToolConfirmationMessage
callId="test-call-id"
confirmationDetails={confirmationDetails}
@@ -163,7 +163,7 @@ describe('ToolConfirmationMessage', () => {
rootCommands: ['curl'],
};
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<ToolConfirmationMessage
callId="test-call-id"
confirmationDetails={confirmationDetails}
@@ -193,7 +193,7 @@ describe('ToolConfirmationMessage', () => {
urls: ['https://еxample.com', 'https://täst.com'],
};
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<ToolConfirmationMessage
callId="test-call-id"
confirmationDetails={confirmationDetails}
@@ -223,7 +223,7 @@ describe('ToolConfirmationMessage', () => {
commands: ['echo "hello"', 'ls -la', 'whoami'], // Multi-command list
};
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<ToolConfirmationMessage
callId="test-call-id"
confirmationDetails={confirmationDetails}
@@ -252,7 +252,7 @@ describe('ToolConfirmationMessage', () => {
rootCommands: ['echo'],
};
const result = renderWithProviders(
const result = await renderWithProviders(
<ToolConfirmationMessage
callId="test-call-id"
confirmationDetails={confirmationDetails}
@@ -336,16 +336,17 @@ describe('ToolConfirmationMessage', () => {
getIdeMode: () => false,
getDisableAlwaysAllow: () => false,
} as unknown as Config;
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
<ToolConfirmationMessage
callId="test-call-id"
confirmationDetails={details}
config={mockConfig}
getPreferredEditor={vi.fn()}
availableTerminalHeight={30}
terminalWidth={80}
/>,
);
const { lastFrame, waitUntilReady, unmount } =
await renderWithProviders(
<ToolConfirmationMessage
callId="test-call-id"
confirmationDetails={details}
config={mockConfig}
getPreferredEditor={vi.fn()}
availableTerminalHeight={30}
terminalWidth={80}
/>,
);
await waitUntilReady();
expect(lastFrame()).toMatchSnapshot();
@@ -359,16 +360,17 @@ describe('ToolConfirmationMessage', () => {
getDisableAlwaysAllow: () => false,
} as unknown as Config;
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
<ToolConfirmationMessage
callId="test-call-id"
confirmationDetails={details}
config={mockConfig}
getPreferredEditor={vi.fn()}
availableTerminalHeight={30}
terminalWidth={80}
/>,
);
const { lastFrame, waitUntilReady, unmount } =
await renderWithProviders(
<ToolConfirmationMessage
callId="test-call-id"
confirmationDetails={details}
config={mockConfig}
getPreferredEditor={vi.fn()}
availableTerminalHeight={30}
terminalWidth={80}
/>,
);
await waitUntilReady();
expect(lastFrame()).toMatchSnapshot();
@@ -394,7 +396,7 @@ describe('ToolConfirmationMessage', () => {
getIdeMode: () => false,
getDisableAlwaysAllow: () => false,
} as unknown as Config;
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<ToolConfirmationMessage
callId="test-call-id"
confirmationDetails={editConfirmationDetails}
@@ -421,7 +423,7 @@ describe('ToolConfirmationMessage', () => {
getIdeMode: () => false,
getDisableAlwaysAllow: () => false,
} as unknown as Config;
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<ToolConfirmationMessage
callId="test-call-id"
confirmationDetails={editConfirmationDetails}
@@ -469,7 +471,7 @@ describe('ToolConfirmationMessage', () => {
isDiffingEnabled: false,
});
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<ToolConfirmationMessage
callId="test-call-id"
confirmationDetails={editConfirmationDetails}
@@ -497,7 +499,7 @@ describe('ToolConfirmationMessage', () => {
isDiffingEnabled: false,
});
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<ToolConfirmationMessage
callId="test-call-id"
confirmationDetails={editConfirmationDetails}
@@ -525,7 +527,7 @@ describe('ToolConfirmationMessage', () => {
isDiffingEnabled: true,
});
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<ToolConfirmationMessage
callId="test-call-id"
confirmationDetails={editConfirmationDetails}
@@ -552,7 +554,7 @@ describe('ToolConfirmationMessage', () => {
onConfirm: vi.fn(),
};
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<ToolConfirmationMessage
callId="test-call-id"
confirmationDetails={confirmationDetails}
@@ -598,7 +600,7 @@ describe('ToolConfirmationMessage', () => {
onConfirm: vi.fn(),
};
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<ToolConfirmationMessage
callId="test-call-id"
confirmationDetails={confirmationDetails}
@@ -630,7 +632,7 @@ describe('ToolConfirmationMessage', () => {
onConfirm: vi.fn(),
};
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<ToolConfirmationMessage
callId="test-call-id"
confirmationDetails={confirmationDetails}
@@ -675,7 +677,7 @@ describe('ToolConfirmationMessage', () => {
urls: ['https://example.com'],
};
const { stdin, waitUntilReady, unmount } = renderWithProviders(
const { stdin, waitUntilReady, unmount } = await renderWithProviders(
<ToolConfirmationMessage
callId="test-call-id"
confirmationDetails={confirmationDetails}

View File

@@ -75,7 +75,7 @@ describe('<ToolGroupMessage />', () => {
it('renders single successful tool call', async () => {
const toolCalls = [createToolCall()];
const item = createItem(toolCalls);
const { lastFrame, unmount, waitUntilReady } = renderWithProviders(
const { lastFrame, unmount, waitUntilReady } = await renderWithProviders(
<ToolGroupMessage {...baseProps} item={item} toolCalls={toolCalls} />,
{
config: baseMockConfig,
@@ -109,7 +109,7 @@ describe('<ToolGroupMessage />', () => {
];
const item = createItem(toolCalls);
const { lastFrame, unmount, waitUntilReady } = renderWithProviders(
const { lastFrame, unmount, waitUntilReady } = await renderWithProviders(
<ToolGroupMessage {...baseProps} item={item} toolCalls={toolCalls} />,
{ config: baseMockConfig, settings: fullVerbositySettings },
);
@@ -130,7 +130,7 @@ describe('<ToolGroupMessage />', () => {
];
const item = createItem(toolCalls);
const { lastFrame, unmount, waitUntilReady } = renderWithProviders(
const { lastFrame, unmount, waitUntilReady } = await renderWithProviders(
<ToolGroupMessage {...baseProps} item={item} toolCalls={toolCalls} />,
{ config: baseMockConfig, settings: fullVerbositySettings },
);
@@ -164,7 +164,7 @@ describe('<ToolGroupMessage />', () => {
];
const item = createItem(toolCalls);
const { lastFrame, unmount, waitUntilReady } = renderWithProviders(
const { lastFrame, unmount, waitUntilReady } = await renderWithProviders(
<ToolGroupMessage {...baseProps} item={item} toolCalls={toolCalls} />,
{
config: baseMockConfig,
@@ -205,7 +205,7 @@ describe('<ToolGroupMessage />', () => {
];
const item = createItem(toolCalls);
const { lastFrame, unmount, waitUntilReady } = renderWithProviders(
const { lastFrame, unmount, waitUntilReady } = await renderWithProviders(
<ToolGroupMessage {...baseProps} item={item} toolCalls={toolCalls} />,
{
config: baseMockConfig,
@@ -238,7 +238,7 @@ describe('<ToolGroupMessage />', () => {
];
const item = createItem(toolCalls);
const { lastFrame, unmount, waitUntilReady } = renderWithProviders(
const { lastFrame, unmount, waitUntilReady } = await renderWithProviders(
<ToolGroupMessage {...baseProps} item={item} toolCalls={toolCalls} />,
{
config: baseMockConfig,
@@ -282,7 +282,7 @@ describe('<ToolGroupMessage />', () => {
];
const item = createItem(toolCalls);
const { lastFrame, unmount, waitUntilReady } = renderWithProviders(
const { lastFrame, unmount, waitUntilReady } = await renderWithProviders(
<ToolGroupMessage {...baseProps} item={item} toolCalls={toolCalls} />,
{
config: baseMockConfig,
@@ -324,7 +324,7 @@ describe('<ToolGroupMessage />', () => {
}),
];
const item = createItem(toolCalls);
const { lastFrame, unmount, waitUntilReady } = renderWithProviders(
const { lastFrame, unmount, waitUntilReady } = await renderWithProviders(
<ToolGroupMessage
{...baseProps}
item={item}
@@ -358,7 +358,7 @@ describe('<ToolGroupMessage />', () => {
}),
];
const item = createItem(toolCalls);
const { lastFrame, unmount, waitUntilReady } = renderWithProviders(
const { lastFrame, unmount, waitUntilReady } = await renderWithProviders(
<ToolGroupMessage
{...baseProps}
item={item}
@@ -386,7 +386,7 @@ describe('<ToolGroupMessage />', () => {
it('renders empty tool calls array', async () => {
const toolCalls: IndividualToolCallDisplay[] = [];
const item = createItem(toolCalls);
const { lastFrame, unmount, waitUntilReady } = renderWithProviders(
const { lastFrame, unmount, waitUntilReady } = await renderWithProviders(
<ToolGroupMessage {...baseProps} item={item} toolCalls={toolCalls} />,
{
config: baseMockConfig,
@@ -423,7 +423,7 @@ describe('<ToolGroupMessage />', () => {
}),
];
const item = createItem(toolCalls);
const { lastFrame, unmount, waitUntilReady } = renderWithProviders(
const { lastFrame, unmount, waitUntilReady } = await renderWithProviders(
<Scrollable height={10} hasFocus={true} scrollToBottom={true}>
<ToolGroupMessage {...baseProps} item={item} toolCalls={toolCalls} />
</Scrollable>,
@@ -456,7 +456,7 @@ describe('<ToolGroupMessage />', () => {
}),
];
const item = createItem(toolCalls);
const { lastFrame, unmount, waitUntilReady } = renderWithProviders(
const { lastFrame, unmount, waitUntilReady } = await renderWithProviders(
<ToolGroupMessage {...baseProps} item={item} toolCalls={toolCalls} />,
{
config: baseMockConfig,
@@ -496,7 +496,7 @@ describe('<ToolGroupMessage />', () => {
];
const item2 = createItem(toolCalls2);
const { lastFrame, unmount, waitUntilReady } = renderWithProviders(
const { lastFrame, unmount, waitUntilReady } = await renderWithProviders(
<Scrollable height={6} hasFocus={true} scrollToBottom={true}>
<ToolGroupMessage
{...baseProps}
@@ -541,7 +541,7 @@ describe('<ToolGroupMessage />', () => {
}),
];
const item = createItem(toolCalls);
const { lastFrame, unmount, waitUntilReady } = renderWithProviders(
const { lastFrame, unmount, waitUntilReady } = await renderWithProviders(
<ToolGroupMessage {...baseProps} item={item} toolCalls={toolCalls} />,
{
config: baseMockConfig,
@@ -571,7 +571,7 @@ describe('<ToolGroupMessage />', () => {
}),
];
const item = createItem(toolCalls);
const { lastFrame, unmount, waitUntilReady } = renderWithProviders(
const { lastFrame, unmount, waitUntilReady } = await renderWithProviders(
<ToolGroupMessage {...baseProps} item={item} toolCalls={toolCalls} />,
{
config: baseMockConfig,
@@ -609,7 +609,7 @@ describe('<ToolGroupMessage />', () => {
}),
];
const item = createItem(toolCalls);
const { lastFrame, unmount, waitUntilReady } = renderWithProviders(
const { lastFrame, unmount, waitUntilReady } = await renderWithProviders(
<ToolGroupMessage
{...baseProps}
item={item}
@@ -676,10 +676,15 @@ describe('<ToolGroupMessage />', () => {
];
const item = createItem(toolCalls);
const { lastFrame, unmount, waitUntilReady } = renderWithProviders(
<ToolGroupMessage {...baseProps} item={item} toolCalls={toolCalls} />,
{ config: baseMockConfig, settings: fullVerbositySettings },
);
const { lastFrame, unmount, waitUntilReady } =
await renderWithProviders(
<ToolGroupMessage
{...baseProps}
item={item}
toolCalls={toolCalls}
/>,
{ config: baseMockConfig, settings: fullVerbositySettings },
);
await waitUntilReady();
if (shouldHide) {
@@ -706,7 +711,7 @@ describe('<ToolGroupMessage />', () => {
];
const item = createItem(toolCalls);
const { lastFrame, unmount, waitUntilReady } = renderWithProviders(
const { lastFrame, unmount, waitUntilReady } = await renderWithProviders(
<ToolGroupMessage {...baseProps} item={item} toolCalls={toolCalls} />,
{ config: baseMockConfig, settings: fullVerbositySettings },
);
@@ -729,7 +734,7 @@ describe('<ToolGroupMessage />', () => {
];
const item = createItem(toolCalls);
const { lastFrame, unmount, waitUntilReady } = renderWithProviders(
const { lastFrame, unmount, waitUntilReady } = await renderWithProviders(
<ToolGroupMessage
{...baseProps}
item={item}
@@ -756,7 +761,7 @@ describe('<ToolGroupMessage />', () => {
];
const item = createItem(toolCalls);
const { lastFrame, unmount, waitUntilReady } = renderWithProviders(
const { lastFrame, unmount, waitUntilReady } = await renderWithProviders(
<ToolGroupMessage
{...baseProps}
item={item}
@@ -779,7 +784,7 @@ describe('<ToolGroupMessage />', () => {
const toolCalls: IndividualToolCallDisplay[] = [];
const item = createItem(toolCalls);
const { lastFrame, unmount, waitUntilReady } = renderWithProviders(
const { lastFrame, unmount, waitUntilReady } = await renderWithProviders(
<ToolGroupMessage
{...baseProps}
item={item}
@@ -810,7 +815,7 @@ describe('<ToolGroupMessage />', () => {
];
const item = createItem(toolCalls);
const { lastFrame, unmount, waitUntilReady } = renderWithProviders(
const { lastFrame, unmount, waitUntilReady } = await renderWithProviders(
<ToolGroupMessage
{...baseProps}
item={item}
@@ -843,7 +848,7 @@ describe('<ToolGroupMessage />', () => {
];
const item = createItem(toolCalls);
const { lastFrame, unmount, waitUntilReady } = renderWithProviders(
const { lastFrame, unmount, waitUntilReady } = await renderWithProviders(
<ToolGroupMessage
{...baseProps}
item={item}
@@ -884,7 +889,7 @@ describe('<ToolGroupMessage />', () => {
const initialItem = createItem(visibleTools);
const hiddenItem = createItem(hiddenTools);
const firstRender = renderWithProviders(
const firstRender = await renderWithProviders(
<ToolGroupMessage
{...baseProps}
item={initialItem}
@@ -901,7 +906,7 @@ describe('<ToolGroupMessage />', () => {
expect(firstRender.lastFrame()).toContain('visible-tool');
firstRender.unmount();
const secondRender = renderWithProviders(
const secondRender = await renderWithProviders(
<ToolGroupMessage
{...baseProps}
item={hiddenItem}
@@ -938,7 +943,7 @@ describe('<ToolGroupMessage />', () => {
const toolCalls = [visibleTool, ...hiddenTools];
const item = createItem(toolCalls);
const { lastFrame, unmount, waitUntilReady } = renderWithProviders(
const { lastFrame, unmount, waitUntilReady } = await renderWithProviders(
<ToolGroupMessage
{...baseProps}
item={item}
@@ -964,7 +969,7 @@ describe('<ToolGroupMessage />', () => {
const toolCalls: IndividualToolCallDisplay[] = [];
const item = createItem(toolCalls);
const { lastFrame, unmount, waitUntilReady } = renderWithProviders(
const { lastFrame, unmount, waitUntilReady } = await renderWithProviders(
<ToolGroupMessage
item={item}
toolCalls={toolCalls}
@@ -1011,10 +1016,15 @@ describe('<ToolGroupMessage />', () => {
];
const item = createItem(toolCalls);
const { lastFrame, unmount, waitUntilReady } = renderWithProviders(
<ToolGroupMessage {...baseProps} item={item} toolCalls={toolCalls} />,
{ config: baseMockConfig, settings: fullVerbositySettings },
);
const { lastFrame, unmount, waitUntilReady } =
await renderWithProviders(
<ToolGroupMessage
{...baseProps}
item={item}
toolCalls={toolCalls}
/>,
{ config: baseMockConfig, settings: fullVerbositySettings },
);
await waitUntilReady();

View File

@@ -58,7 +58,7 @@ describe('<ToolMessage />', () => {
};
// Helper to render with context
const renderWithContext = (
const renderWithContext = async (
ui: React.ReactElement,
streamingState: StreamingState,
) =>
@@ -78,7 +78,7 @@ describe('<ToolMessage />', () => {
});
it('renders basic tool information', async () => {
const { lastFrame, waitUntilReady, unmount } = renderWithContext(
const { lastFrame, waitUntilReady, unmount } = await renderWithContext(
<ToolMessage {...baseProps} />,
StreamingState.Idle,
);
@@ -91,7 +91,7 @@ describe('<ToolMessage />', () => {
describe('JSON rendering', () => {
it('pretty prints valid JSON', async () => {
const testJSONstring = '{"a": 1, "b": [2, 3]}';
const { lastFrame, waitUntilReady, unmount } = renderWithContext(
const { lastFrame, waitUntilReady, unmount } = await renderWithContext(
<ToolMessage
{...baseProps}
resultDisplay={testJSONstring}
@@ -113,7 +113,7 @@ describe('<ToolMessage />', () => {
});
it('renders pretty JSON in ink frame', async () => {
const { lastFrame, waitUntilReady, unmount } = renderWithContext(
const { lastFrame, waitUntilReady, unmount } = await renderWithContext(
<ToolMessage {...baseProps} resultDisplay='{"a":1,"b":2}' />,
StreamingState.Idle,
);
@@ -127,7 +127,7 @@ describe('<ToolMessage />', () => {
it('uses JSON renderer even when renderOutputAsMarkdown=true is true', async () => {
const testJSONstring = '{"a": 1, "b": [2, 3]}';
const { lastFrame, waitUntilReady, unmount } = renderWithContext(
const { lastFrame, waitUntilReady, unmount } = await renderWithContext(
<ToolMessage
{...baseProps}
resultDisplay={testJSONstring}
@@ -149,7 +149,7 @@ describe('<ToolMessage />', () => {
});
it('falls back to plain text for malformed JSON', async () => {
const testJSONstring = 'a": 1, "b": [2, 3]}';
const { lastFrame, waitUntilReady, unmount } = renderWithContext(
const { lastFrame, waitUntilReady, unmount } = await renderWithContext(
<ToolMessage
{...baseProps}
resultDisplay={testJSONstring}
@@ -168,7 +168,7 @@ describe('<ToolMessage />', () => {
it('rejects mixed text + JSON renders as plain text', async () => {
const testJSONstring = `{"result": "count": 42,"items": ["apple", "banana"]},"meta": {"timestamp": "2025-09-28T12:34:56Z"}}End.`;
const { lastFrame, waitUntilReady, unmount } = renderWithContext(
const { lastFrame, waitUntilReady, unmount } = await renderWithContext(
<ToolMessage
{...baseProps}
resultDisplay={testJSONstring}
@@ -188,7 +188,7 @@ describe('<ToolMessage />', () => {
it('rejects ANSI-tained JSON renders as plain text', async () => {
const testJSONstring =
'\u001b[32mOK\u001b[0m {"status": "success", "data": {"id": 123, "values": [10, 20, 30]}}';
const { lastFrame, waitUntilReady, unmount } = renderWithContext(
const { lastFrame, waitUntilReady, unmount } = await renderWithContext(
<ToolMessage
{...baseProps}
resultDisplay={testJSONstring}
@@ -207,7 +207,7 @@ describe('<ToolMessage />', () => {
it('pretty printing 10kb JSON completes in <50ms', async () => {
const large = '{"key": "' + 'x'.repeat(10000) + '"}';
const { lastFrame, waitUntilReady, unmount } = renderWithContext(
const { lastFrame, waitUntilReady, unmount } = await renderWithContext(
<ToolMessage
{...baseProps}
resultDisplay={large}
@@ -226,7 +226,7 @@ describe('<ToolMessage />', () => {
describe('ToolStatusIndicator rendering', () => {
it('shows ✓ for Success status', async () => {
const { lastFrame, waitUntilReady, unmount } = renderWithContext(
const { lastFrame, waitUntilReady, unmount } = await renderWithContext(
<ToolMessage {...baseProps} status={CoreToolCallStatus.Success} />,
StreamingState.Idle,
);
@@ -236,7 +236,7 @@ describe('<ToolMessage />', () => {
});
it('shows o for Pending status', async () => {
const { lastFrame, waitUntilReady, unmount } = renderWithContext(
const { lastFrame, waitUntilReady, unmount } = await renderWithContext(
<ToolMessage {...baseProps} status={CoreToolCallStatus.Scheduled} />,
StreamingState.Idle,
);
@@ -246,7 +246,7 @@ describe('<ToolMessage />', () => {
});
it('shows ? for Confirming status', async () => {
const { lastFrame, waitUntilReady, unmount } = renderWithContext(
const { lastFrame, waitUntilReady, unmount } = await renderWithContext(
<ToolMessage
{...baseProps}
status={CoreToolCallStatus.AwaitingApproval}
@@ -259,7 +259,7 @@ describe('<ToolMessage />', () => {
});
it('shows - for Canceled status', async () => {
const { lastFrame, waitUntilReady, unmount } = renderWithContext(
const { lastFrame, waitUntilReady, unmount } = await renderWithContext(
<ToolMessage {...baseProps} status={CoreToolCallStatus.Cancelled} />,
StreamingState.Idle,
);
@@ -269,7 +269,7 @@ describe('<ToolMessage />', () => {
});
it('shows x for Error status', async () => {
const { lastFrame, waitUntilReady, unmount } = renderWithContext(
const { lastFrame, waitUntilReady, unmount } = await renderWithContext(
<ToolMessage {...baseProps} status={CoreToolCallStatus.Error} />,
StreamingState.Idle,
);
@@ -279,7 +279,7 @@ describe('<ToolMessage />', () => {
});
it('shows paused spinner for Executing status when streamingState is Idle', async () => {
const { lastFrame, waitUntilReady, unmount } = renderWithContext(
const { lastFrame, waitUntilReady, unmount } = await renderWithContext(
<ToolMessage {...baseProps} status={CoreToolCallStatus.Executing} />,
StreamingState.Idle,
);
@@ -289,7 +289,7 @@ describe('<ToolMessage />', () => {
});
it('shows paused spinner for Executing status when streamingState is WaitingForConfirmation', async () => {
const { lastFrame, waitUntilReady, unmount } = renderWithContext(
const { lastFrame, waitUntilReady, unmount } = await renderWithContext(
<ToolMessage {...baseProps} status={CoreToolCallStatus.Executing} />,
StreamingState.WaitingForConfirmation,
);
@@ -299,7 +299,7 @@ describe('<ToolMessage />', () => {
});
it('shows MockRespondingSpinner for Executing status when streamingState is Responding', async () => {
const { lastFrame, waitUntilReady, unmount } = renderWithContext(
const { lastFrame, waitUntilReady, unmount } = await renderWithContext(
<ToolMessage {...baseProps} status={CoreToolCallStatus.Executing} />,
StreamingState.Responding, // Simulate app still responding
);
@@ -317,7 +317,7 @@ describe('<ToolMessage />', () => {
newContent: 'new',
filePath: 'file.txt',
};
const { lastFrame, waitUntilReady, unmount } = renderWithContext(
const { lastFrame, waitUntilReady, unmount } = await renderWithContext(
<ToolMessage {...baseProps} resultDisplay={diffResult} />,
StreamingState.Idle,
);
@@ -332,7 +332,7 @@ describe('<ToolMessage />', () => {
lastFrame: highEmphasisFrame,
waitUntilReady: waitUntilReadyHigh,
unmount: unmountHigh,
} = renderWithContext(
} = await renderWithContext(
<ToolMessage {...baseProps} emphasis="high" />,
StreamingState.Idle,
);
@@ -345,7 +345,7 @@ describe('<ToolMessage />', () => {
lastFrame: lowEmphasisFrame,
waitUntilReady: waitUntilReadyLow,
unmount: unmountLow,
} = renderWithContext(
} = await renderWithContext(
<ToolMessage {...baseProps} emphasis="low" />,
StreamingState.Idle,
);
@@ -372,7 +372,7 @@ describe('<ToolMessage />', () => {
},
],
];
const { lastFrame, waitUntilReady, unmount } = renderWithContext(
const { lastFrame, waitUntilReady, unmount } = await renderWithContext(
<ToolMessage {...baseProps} resultDisplay={ansiResult} />,
StreamingState.Idle,
);
@@ -382,7 +382,7 @@ describe('<ToolMessage />', () => {
});
it('renders McpProgressIndicator with percentage and message for executing tools', async () => {
const { lastFrame, waitUntilReady, unmount } = renderWithContext(
const { lastFrame, waitUntilReady, unmount } = await renderWithContext(
<ToolMessage
{...baseProps}
status={CoreToolCallStatus.Executing}
@@ -404,7 +404,7 @@ describe('<ToolMessage />', () => {
});
it('renders only percentage when progressMessage is missing', async () => {
const { lastFrame, waitUntilReady, unmount } = renderWithContext(
const { lastFrame, waitUntilReady, unmount } = await renderWithContext(
<ToolMessage
{...baseProps}
status={CoreToolCallStatus.Executing}
@@ -424,7 +424,7 @@ describe('<ToolMessage />', () => {
});
it('renders indeterminate progress when total is missing', async () => {
const { lastFrame, waitUntilReady, unmount } = renderWithContext(
const { lastFrame, waitUntilReady, unmount } = await renderWithContext(
<ToolMessage
{...baseProps}
status={CoreToolCallStatus.Executing}
@@ -449,7 +449,7 @@ describe('<ToolMessage />', () => {
(_, i) => `Line ${i + 1}`,
).join('\n');
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<ToolMessage
{...baseProps}
kind={Kind.Agent}
@@ -486,7 +486,7 @@ describe('<ToolMessage />', () => {
(_, i) => `Line ${i + 1}`,
).join('\n');
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<ToolMessage
{...baseProps}
kind={Kind.Agent}
@@ -516,7 +516,7 @@ describe('<ToolMessage />', () => {
(_, i) => `Line ${i + 1}`,
).join('\n');
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<ToolMessage
{...baseProps}
kind={Kind.Read}

View File

@@ -66,7 +66,7 @@ describe('Focus Hint', () => {
describe.each(testCases)('$componentName', ({ Component }) => {
it('shows focus hint after delay even with NO output', async () => {
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<Component {...baseProps} resultDisplay={undefined} />,
{ uiState: { streamingState: StreamingState.Idle } },
);
@@ -88,7 +88,7 @@ describe('Focus Hint', () => {
});
it('shows focus hint after delay with output', async () => {
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<Component {...baseProps} resultDisplay="Some output" />,
{ uiState: { streamingState: StreamingState.Idle } },
);
@@ -111,7 +111,7 @@ describe('Focus Hint', () => {
it('handles long descriptions by shrinking them to show the focus hint', async () => {
const longDescription = 'A'.repeat(100);
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<ToolMessage
{...baseProps}
description={longDescription}

View File

@@ -64,7 +64,7 @@ describe('<ToolMessage /> - Raw Markdown Display Snapshots', () => {
])(
'renders with renderMarkdown=$renderMarkdown, useAlternateBuffer=$useAlternateBuffer $description',
async ({ renderMarkdown, useAlternateBuffer, availableTerminalHeight }) => {
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<StreamingContext.Provider value={StreamingState.Idle}>
<ToolMessage
{...baseProps}

View File

@@ -41,7 +41,7 @@ describe('ToolOverflowConsistencyChecks: ToolGroupMessage and ToolResultDisplay
return null;
};
const { unmount, waitUntilReady } = renderWithProviders(
const { unmount, waitUntilReady } = await renderWithProviders(
<>
<StateCapture />
<ToolGroupMessage
@@ -95,7 +95,7 @@ describe('ToolOverflowConsistencyChecks: ToolGroupMessage and ToolResultDisplay
},
];
const { lastFrame, unmount, waitUntilReady } = renderWithProviders(
const { lastFrame, unmount, waitUntilReady } = await renderWithProviders(
<ToolGroupMessage
item={{ id: 1, type: 'tool_group', tools: toolCalls }}
toolCalls={toolCalls}

View File

@@ -31,7 +31,7 @@ describe('ToolResultDisplay', () => {
},
],
];
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<ToolResultDisplay
resultDisplay={ansiResult}
terminalWidth={80}
@@ -50,7 +50,7 @@ describe('ToolResultDisplay', () => {
});
it('uses Scrollable for non-ANSI output in alternate buffer mode', async () => {
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<ToolResultDisplay
resultDisplay="**Markdown content**"
terminalWidth={80}
@@ -70,7 +70,7 @@ describe('ToolResultDisplay', () => {
});
it('passes hasFocus prop to scrollable components', async () => {
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<ToolResultDisplay
resultDisplay="Some result"
terminalWidth={80}
@@ -88,7 +88,7 @@ describe('ToolResultDisplay', () => {
});
it('renders string result as markdown by default', async () => {
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<ToolResultDisplay resultDisplay="**Some result**" terminalWidth={80} />,
{
config: makeFakeConfig({ useAlternateBuffer: false }),
@@ -103,7 +103,7 @@ describe('ToolResultDisplay', () => {
});
it('renders string result as plain text when renderOutputAsMarkdown is false', async () => {
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<ToolResultDisplay
resultDisplay="**Some result**"
terminalWidth={80}
@@ -125,7 +125,7 @@ describe('ToolResultDisplay', () => {
it('truncates very long string results', { timeout: 20000 }, async () => {
const longString = 'a'.repeat(1000005);
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<ToolResultDisplay
resultDisplay={longString}
terminalWidth={80}
@@ -149,7 +149,7 @@ describe('ToolResultDisplay', () => {
fileDiff: 'diff content',
fileName: 'test.ts',
};
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<ToolResultDisplay
resultDisplay={diffResult}
terminalWidth={80}
@@ -182,7 +182,7 @@ describe('ToolResultDisplay', () => {
},
],
];
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<ToolResultDisplay
resultDisplay={ansiResult as unknown as AnsiOutput}
terminalWidth={80}
@@ -204,7 +204,7 @@ describe('ToolResultDisplay', () => {
const todoResult = {
todos: [],
};
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<ToolResultDisplay
resultDisplay={todoResult}
terminalWidth={80}
@@ -224,7 +224,7 @@ describe('ToolResultDisplay', () => {
it('does not fall back to plain text if availableHeight is set and not in alternate buffer', async () => {
// availableHeight calculation: 20 - 1 - 5 = 14 > 3
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<ToolResultDisplay
resultDisplay="**Some result**"
terminalWidth={80}
@@ -244,7 +244,7 @@ describe('ToolResultDisplay', () => {
});
it('keeps markdown if in alternate buffer even with availableHeight', async () => {
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<ToolResultDisplay
resultDisplay="**Some result**"
terminalWidth={80}
@@ -326,7 +326,7 @@ describe('ToolResultDisplay', () => {
},
],
];
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<ToolResultDisplay
resultDisplay={ansiResult}
terminalWidth={80}
@@ -363,7 +363,7 @@ describe('ToolResultDisplay', () => {
inverse: false,
},
]);
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<ToolResultDisplay
resultDisplay={ansiResult}
terminalWidth={80}

View File

@@ -13,7 +13,7 @@ import { makeFakeConfig, type AnsiOutput } from '@google/gemini-cli-core';
describe('ToolResultDisplay Overflow', () => {
it('shows the head of the content when overflowDirection is bottom (string)', async () => {
const content = 'Line 1\nLine 2\nLine 3\nLine 4\nLine 5';
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<ToolResultDisplay
resultDisplay={content}
terminalWidth={80}
@@ -40,7 +40,7 @@ describe('ToolResultDisplay Overflow', () => {
it('shows the tail of the content when overflowDirection is top (string default)', async () => {
const content = 'Line 1\nLine 2\nLine 3\nLine 4\nLine 5';
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<ToolResultDisplay
resultDisplay={content}
terminalWidth={80}
@@ -78,7 +78,7 @@ describe('ToolResultDisplay Overflow', () => {
inverse: false,
},
]);
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<ToolResultDisplay
resultDisplay={ansiResult}
terminalWidth={80}

View File

@@ -91,7 +91,7 @@ describe('ToolMessage Sticky Header Regression', () => {
);
};
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<Box height={terminalHeight}>
<TestComponent />
</Box>,
@@ -181,7 +181,7 @@ describe('ToolMessage Sticky Header Regression', () => {
);
};
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<Box height={terminalHeight}>
<TestComponent />
</Box>,

View File

@@ -15,7 +15,7 @@ vi.mock('../../utils/commandUtils.js', () => ({
describe('UserMessage', () => {
it('renders normal user message with correct prefix', async () => {
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<UserMessage text="Hello Gemini" width={80} />,
{ width: 80 },
);
@@ -27,7 +27,7 @@ describe('UserMessage', () => {
});
it('renders slash command message', async () => {
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<UserMessage text="/help" width={80} />,
{ width: 80 },
);
@@ -40,7 +40,7 @@ describe('UserMessage', () => {
it('renders multiline user message', async () => {
const message = 'Line 1\nLine 2';
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<UserMessage text={message} width={80} />,
{ width: 80 },
);
@@ -53,7 +53,7 @@ describe('UserMessage', () => {
it('transforms image paths in user message', async () => {
const message = 'Check out this image: @/path/to/my-image.png';
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
const { lastFrame, waitUntilReady, unmount } = await renderWithProviders(
<UserMessage text={message} width={80} />,
{ width: 80 },
);