mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-15 06:12:50 -07:00
restore
This commit is contained in:
@@ -94,10 +94,7 @@ describe('App', () => {
|
|||||||
it('should render main content and composer when not quitting', async () => {
|
it('should render main content and composer when not quitting', async () => {
|
||||||
const { lastFrame, unmount } = await renderWithProviders(<App />, {
|
const { lastFrame, unmount } = await renderWithProviders(<App />, {
|
||||||
uiState: mockUIState,
|
uiState: mockUIState,
|
||||||
settings: createMockSettings({
|
settings: createMockSettings({ ui: { useAlternateBuffer: false } }),
|
||||||
ui: { useAlternateBuffer: false },
|
|
||||||
security: { enablePermanentToolApproval: false },
|
|
||||||
}),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(lastFrame()).toContain('Tips for getting started');
|
expect(lastFrame()).toContain('Tips for getting started');
|
||||||
@@ -114,10 +111,7 @@ describe('App', () => {
|
|||||||
|
|
||||||
const { lastFrame, unmount } = await renderWithProviders(<App />, {
|
const { lastFrame, unmount } = await renderWithProviders(<App />, {
|
||||||
uiState: quittingUIState,
|
uiState: quittingUIState,
|
||||||
settings: createMockSettings({
|
settings: createMockSettings({ ui: { useAlternateBuffer: false } }),
|
||||||
ui: { useAlternateBuffer: false },
|
|
||||||
security: { enablePermanentToolApproval: false },
|
|
||||||
}),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(lastFrame()).toContain('Quitting...');
|
expect(lastFrame()).toContain('Quitting...');
|
||||||
@@ -134,10 +128,7 @@ describe('App', () => {
|
|||||||
|
|
||||||
const { lastFrame, unmount } = await renderWithProviders(<App />, {
|
const { lastFrame, unmount } = await renderWithProviders(<App />, {
|
||||||
uiState: quittingUIState,
|
uiState: quittingUIState,
|
||||||
settings: createMockSettings({
|
settings: createMockSettings({ ui: { useAlternateBuffer: true } }),
|
||||||
ui: { useAlternateBuffer: true },
|
|
||||||
security: { enablePermanentToolApproval: false },
|
|
||||||
}),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(lastFrame()).toContain('HistoryItemDisplay');
|
expect(lastFrame()).toContain('HistoryItemDisplay');
|
||||||
@@ -153,10 +144,7 @@ describe('App', () => {
|
|||||||
|
|
||||||
const { lastFrame, unmount } = await renderWithProviders(<App />, {
|
const { lastFrame, unmount } = await renderWithProviders(<App />, {
|
||||||
uiState: dialogUIState,
|
uiState: dialogUIState,
|
||||||
settings: createMockSettings({
|
settings: createMockSettings({ ui: { useAlternateBuffer: true } }),
|
||||||
ui: { useAlternateBuffer: true },
|
|
||||||
security: { enablePermanentToolApproval: false },
|
|
||||||
}),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(lastFrame()).toContain('Tips for getting started');
|
expect(lastFrame()).toContain('Tips for getting started');
|
||||||
@@ -179,10 +167,7 @@ describe('App', () => {
|
|||||||
|
|
||||||
const { lastFrame, unmount } = await renderWithProviders(<App />, {
|
const { lastFrame, unmount } = await renderWithProviders(<App />, {
|
||||||
uiState,
|
uiState,
|
||||||
settings: createMockSettings({
|
settings: createMockSettings({ ui: { useAlternateBuffer: true } }),
|
||||||
ui: { useAlternateBuffer: true },
|
|
||||||
security: { enablePermanentToolApproval: false },
|
|
||||||
}),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(lastFrame()).toContain(`Press Ctrl+${key} again to exit.`);
|
expect(lastFrame()).toContain(`Press Ctrl+${key} again to exit.`);
|
||||||
@@ -195,10 +180,7 @@ describe('App', () => {
|
|||||||
|
|
||||||
const { lastFrame, unmount } = await renderWithProviders(<App />, {
|
const { lastFrame, unmount } = await renderWithProviders(<App />, {
|
||||||
uiState: mockUIState,
|
uiState: mockUIState,
|
||||||
settings: createMockSettings({
|
settings: createMockSettings({ ui: { useAlternateBuffer: true } }),
|
||||||
ui: { useAlternateBuffer: true },
|
|
||||||
security: { enablePermanentToolApproval: false },
|
|
||||||
}),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(lastFrame()).toContain('Notifications');
|
expect(lastFrame()).toContain('Notifications');
|
||||||
@@ -213,10 +195,7 @@ describe('App', () => {
|
|||||||
|
|
||||||
const { lastFrame, unmount } = await renderWithProviders(<App />, {
|
const { lastFrame, unmount } = await renderWithProviders(<App />, {
|
||||||
uiState: mockUIState,
|
uiState: mockUIState,
|
||||||
settings: createMockSettings({
|
settings: createMockSettings({ ui: { useAlternateBuffer: true } }),
|
||||||
ui: { useAlternateBuffer: true },
|
|
||||||
security: { enablePermanentToolApproval: false },
|
|
||||||
}),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(lastFrame()).toContain('Tips for getting started');
|
expect(lastFrame()).toContain('Tips for getting started');
|
||||||
@@ -268,10 +247,7 @@ describe('App', () => {
|
|||||||
const { lastFrame, unmount } = await renderWithProviders(<App />, {
|
const { lastFrame, unmount } = await renderWithProviders(<App />, {
|
||||||
uiState: stateWithConfirmingTool,
|
uiState: stateWithConfirmingTool,
|
||||||
config: configWithExperiment,
|
config: configWithExperiment,
|
||||||
settings: createMockSettings({
|
settings: createMockSettings({ ui: { useAlternateBuffer: true } }),
|
||||||
ui: { useAlternateBuffer: true },
|
|
||||||
security: { enablePermanentToolApproval: false },
|
|
||||||
}),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(lastFrame()).toContain('Tips for getting started');
|
expect(lastFrame()).toContain('Tips for getting started');
|
||||||
@@ -287,10 +263,7 @@ describe('App', () => {
|
|||||||
(useIsScreenReaderEnabled as Mock).mockReturnValue(false);
|
(useIsScreenReaderEnabled as Mock).mockReturnValue(false);
|
||||||
const { lastFrame, unmount } = await renderWithProviders(<App />, {
|
const { lastFrame, unmount } = await renderWithProviders(<App />, {
|
||||||
uiState: mockUIState,
|
uiState: mockUIState,
|
||||||
settings: createMockSettings({
|
settings: createMockSettings({ ui: { useAlternateBuffer: true } }),
|
||||||
ui: { useAlternateBuffer: true },
|
|
||||||
security: { enablePermanentToolApproval: false },
|
|
||||||
}),
|
|
||||||
});
|
});
|
||||||
expect(lastFrame()).toMatchSnapshot();
|
expect(lastFrame()).toMatchSnapshot();
|
||||||
unmount();
|
unmount();
|
||||||
@@ -300,10 +273,7 @@ describe('App', () => {
|
|||||||
(useIsScreenReaderEnabled as Mock).mockReturnValue(true);
|
(useIsScreenReaderEnabled as Mock).mockReturnValue(true);
|
||||||
const { lastFrame, unmount } = await renderWithProviders(<App />, {
|
const { lastFrame, unmount } = await renderWithProviders(<App />, {
|
||||||
uiState: mockUIState,
|
uiState: mockUIState,
|
||||||
settings: createMockSettings({
|
settings: createMockSettings({ ui: { useAlternateBuffer: true } }),
|
||||||
ui: { useAlternateBuffer: true },
|
|
||||||
security: { enablePermanentToolApproval: false },
|
|
||||||
}),
|
|
||||||
});
|
});
|
||||||
expect(lastFrame()).toMatchSnapshot();
|
expect(lastFrame()).toMatchSnapshot();
|
||||||
unmount();
|
unmount();
|
||||||
@@ -316,10 +286,7 @@ describe('App', () => {
|
|||||||
} as UIState;
|
} as UIState;
|
||||||
const { lastFrame, unmount } = await renderWithProviders(<App />, {
|
const { lastFrame, unmount } = await renderWithProviders(<App />, {
|
||||||
uiState: dialogUIState,
|
uiState: dialogUIState,
|
||||||
settings: createMockSettings({
|
settings: createMockSettings({ ui: { useAlternateBuffer: true } }),
|
||||||
ui: { useAlternateBuffer: true },
|
|
||||||
security: { enablePermanentToolApproval: false },
|
|
||||||
}),
|
|
||||||
});
|
});
|
||||||
expect(lastFrame()).toMatchSnapshot();
|
expect(lastFrame()).toMatchSnapshot();
|
||||||
unmount();
|
unmount();
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ describe('Full Terminal Tool Confirmation Snapshot', () => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
security: {
|
security: {
|
||||||
enablePermanentToolApproval: false,
|
enablePermanentToolApproval: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -203,10 +203,7 @@ describe('ToolConfirmationQueue', () => {
|
|||||||
/>,
|
/>,
|
||||||
{
|
{
|
||||||
config: mockConfig,
|
config: mockConfig,
|
||||||
settings: createMockSettings({
|
settings: createMockSettings({ ui: { useAlternateBuffer: false } }),
|
||||||
ui: { useAlternateBuffer: false },
|
|
||||||
security: { enablePermanentToolApproval: false },
|
|
||||||
}),
|
|
||||||
uiState: {
|
uiState: {
|
||||||
terminalWidth: 80,
|
terminalWidth: 80,
|
||||||
terminalHeight: 40,
|
terminalHeight: 40,
|
||||||
|
|||||||
@@ -4,34 +4,36 @@
|
|||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { describe, it, expect, beforeAll, vi } from 'vitest';
|
import { describe, it, expect, beforeAll } from 'vitest';
|
||||||
import { ToolConfirmationMessage } from './ToolConfirmationMessage.js';
|
import { ToolConfirmationMessage } from './ToolConfirmationMessage.js';
|
||||||
import type { SerializableConfirmationDetails , Config} from '@google/gemini-cli-core';
|
import type {
|
||||||
|
SerializableConfirmationDetails,
|
||||||
|
Config,
|
||||||
|
} from '@google/gemini-cli-core';
|
||||||
import { initializeShellParsers } from '@google/gemini-cli-core';
|
import { initializeShellParsers } from '@google/gemini-cli-core';
|
||||||
import { renderWithProviders } from '../../../test-utils/render.js';
|
import { renderWithProviders } from '../../../test-utils/render.js';
|
||||||
import { createMockSettings } from '../../../test-utils/settings.js';
|
|
||||||
|
|
||||||
describe('ToolConfirmationMessage Redirection', () => {
|
describe('ToolConfirmationMessage Redirection', () => {
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
await initializeShellParsers();
|
await initializeShellParsers();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const mockConfig = {
|
||||||
|
isTrustedFolder: () => true,
|
||||||
|
getIdeMode: () => false,
|
||||||
|
getDisableAlwaysAllow: () => false,
|
||||||
|
getApprovalMode: () => 'default',
|
||||||
|
} as unknown as Config;
|
||||||
|
|
||||||
it('should display redirection warning and tip for redirected commands', async () => {
|
it('should display redirection warning and tip for redirected commands', async () => {
|
||||||
const confirmationDetails: SerializableConfirmationDetails = {
|
const confirmationDetails: SerializableConfirmationDetails = {
|
||||||
type: 'exec',
|
type: 'exec',
|
||||||
title: 'Confirm execution',
|
title: 'Confirm Shell Command',
|
||||||
command: 'echo "hello" > test.txt',
|
command: 'echo "hello" > test.txt',
|
||||||
rootCommand: 'echo',
|
rootCommand: 'echo, redirection (>)',
|
||||||
rootCommands: ['echo'],
|
rootCommands: ['echo'],
|
||||||
};
|
};
|
||||||
|
|
||||||
const mockConfig = {
|
|
||||||
isTrustedFolder: () => true,
|
|
||||||
getIdeMode: () => false,
|
|
||||||
getDisableAlwaysAllow: () => false,
|
|
||||||
getApprovalMode: () => 'default',
|
|
||||||
} as unknown as Config;
|
|
||||||
|
|
||||||
const { lastFrame, unmount } = await renderWithProviders(
|
const { lastFrame, unmount } = await renderWithProviders(
|
||||||
<ToolConfirmationMessage
|
<ToolConfirmationMessage
|
||||||
callId="test-call-id"
|
callId="test-call-id"
|
||||||
@@ -42,11 +44,6 @@ describe('ToolConfirmationMessage Redirection', () => {
|
|||||||
terminalWidth={100}
|
terminalWidth={100}
|
||||||
toolName="shell"
|
toolName="shell"
|
||||||
/>,
|
/>,
|
||||||
{
|
|
||||||
settings: createMockSettings({
|
|
||||||
security: { enablePermanentToolApproval: false },
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const output = lastFrame();
|
const output = lastFrame();
|
||||||
|
|||||||
@@ -419,7 +419,7 @@ describe('ToolConfirmationMessage', () => {
|
|||||||
unmount();
|
unmount();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should show "Allow for all future sessions" when trusted (default)', async () => {
|
it('should show "Allow for all future sessions" when trusted', async () => {
|
||||||
const mockConfig = {
|
const mockConfig = {
|
||||||
isTrustedFolder: () => true,
|
isTrustedFolder: () => true,
|
||||||
getIdeMode: () => false,
|
getIdeMode: () => false,
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
||||||
|
|
||||||
exports[`ToolConfirmationMessage > enablePermanentToolApproval setting > should show "Allow for all future sessions" when trusted (default) 1`] = `
|
exports[`ToolConfirmationMessage > enablePermanentToolApproval setting > should show "Allow for all future sessions" when trusted 1`] = `
|
||||||
"╭──────────────────────────────────────────────────────────────────────────────╮
|
"╭──────────────────────────────────────────────────────────────────────────────╮
|
||||||
│ │
|
│ │
|
||||||
│ No changes detected. │
|
│ No changes detected. │
|
||||||
|
|||||||
Reference in New Issue
Block a user