mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-13 21:32:56 -07:00
fix(ui): added quotes around session id in resume tip (#26669)
This commit is contained in:
@@ -13,6 +13,7 @@ import { type SessionMetrics } from '../contexts/SessionContext.js';
|
||||
import {
|
||||
ToolCallDecision,
|
||||
getShellConfiguration,
|
||||
isWindows,
|
||||
type WorktreeSettings,
|
||||
} from '@google/gemini-cli-core';
|
||||
|
||||
@@ -22,6 +23,7 @@ vi.mock('@google/gemini-cli-core', async (importOriginal) => {
|
||||
return {
|
||||
...actual,
|
||||
getShellConfiguration: vi.fn(),
|
||||
isWindows: vi.fn(),
|
||||
};
|
||||
});
|
||||
|
||||
@@ -44,6 +46,7 @@ vi.mock('../contexts/ConfigContext.js', async (importOriginal) => {
|
||||
});
|
||||
|
||||
const getShellConfigurationMock = vi.mocked(getShellConfiguration);
|
||||
const isWindowsMock = vi.mocked(isWindows);
|
||||
const useSessionStatsMock = vi.mocked(SessionContext.useSessionStats);
|
||||
|
||||
const renderWithMockedStats = async (
|
||||
@@ -106,6 +109,7 @@ describe('<SessionSummaryDisplay />', () => {
|
||||
argsPrefix: ['-c'],
|
||||
shell: 'bash',
|
||||
});
|
||||
isWindowsMock.mockReturnValue(false);
|
||||
});
|
||||
|
||||
it('renders the summary display with a title', async () => {
|
||||
@@ -149,7 +153,7 @@ describe('<SessionSummaryDisplay />', () => {
|
||||
);
|
||||
const output = lastFrame();
|
||||
|
||||
// Standard UUID characters should not be escaped/quoted by default for bash.
|
||||
// Standard UUID characters are NOT wrapped in double quotes on non-Windows.
|
||||
expect(output).toContain('gemini --resume 1234-abcd-5678-efgh');
|
||||
unmount();
|
||||
});
|
||||
@@ -167,7 +171,8 @@ describe('<SessionSummaryDisplay />', () => {
|
||||
unmount();
|
||||
});
|
||||
|
||||
it('renders a standard UUID-formatted session ID in the footer (powershell)', async () => {
|
||||
it('renders a standard UUID-formatted session ID in the footer (powershell) on Windows', async () => {
|
||||
isWindowsMock.mockReturnValue(true);
|
||||
getShellConfigurationMock.mockReturnValue({
|
||||
executable: 'powershell.exe',
|
||||
argsPrefix: ['-NoProfile', '-Command'],
|
||||
@@ -181,9 +186,8 @@ describe('<SessionSummaryDisplay />', () => {
|
||||
);
|
||||
const output = lastFrame();
|
||||
|
||||
// PowerShell doesn't wraps UUID in single quotes because
|
||||
// it contains no special characters.
|
||||
expect(output).toContain('gemini --resume 1234-abcd-5678-efgh');
|
||||
// PowerShell doesn't wrap UUID in quotes by default, but we wrap it in double quotes on Windows.
|
||||
expect(output).toContain('gemini --resume "1234-abcd-5678-efgh"');
|
||||
unmount();
|
||||
});
|
||||
|
||||
@@ -201,7 +205,8 @@ describe('<SessionSummaryDisplay />', () => {
|
||||
);
|
||||
const output = lastFrame();
|
||||
|
||||
// PowerShell wraps in single quotes and escapes internal single quotes by doubling them
|
||||
// PowerShell wraps in single quotes and escapes internal single quotes by doubling them.
|
||||
// Since it's already quoted, we don't add redundant double quotes.
|
||||
expect(output).toContain("gemini --resume '''; rm -rf / #'");
|
||||
unmount();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user