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 () => {
|
||||
const { lastFrame, unmount } = await renderWithProviders(<App />, {
|
||||
uiState: mockUIState,
|
||||
settings: createMockSettings({
|
||||
ui: { useAlternateBuffer: false },
|
||||
security: { enablePermanentToolApproval: false },
|
||||
}),
|
||||
settings: createMockSettings({ ui: { useAlternateBuffer: false } }),
|
||||
});
|
||||
|
||||
expect(lastFrame()).toContain('Tips for getting started');
|
||||
@@ -114,10 +111,7 @@ describe('App', () => {
|
||||
|
||||
const { lastFrame, unmount } = await renderWithProviders(<App />, {
|
||||
uiState: quittingUIState,
|
||||
settings: createMockSettings({
|
||||
ui: { useAlternateBuffer: false },
|
||||
security: { enablePermanentToolApproval: false },
|
||||
}),
|
||||
settings: createMockSettings({ ui: { useAlternateBuffer: false } }),
|
||||
});
|
||||
|
||||
expect(lastFrame()).toContain('Quitting...');
|
||||
@@ -134,10 +128,7 @@ describe('App', () => {
|
||||
|
||||
const { lastFrame, unmount } = await renderWithProviders(<App />, {
|
||||
uiState: quittingUIState,
|
||||
settings: createMockSettings({
|
||||
ui: { useAlternateBuffer: true },
|
||||
security: { enablePermanentToolApproval: false },
|
||||
}),
|
||||
settings: createMockSettings({ ui: { useAlternateBuffer: true } }),
|
||||
});
|
||||
|
||||
expect(lastFrame()).toContain('HistoryItemDisplay');
|
||||
@@ -153,10 +144,7 @@ describe('App', () => {
|
||||
|
||||
const { lastFrame, unmount } = await renderWithProviders(<App />, {
|
||||
uiState: dialogUIState,
|
||||
settings: createMockSettings({
|
||||
ui: { useAlternateBuffer: true },
|
||||
security: { enablePermanentToolApproval: false },
|
||||
}),
|
||||
settings: createMockSettings({ ui: { useAlternateBuffer: true } }),
|
||||
});
|
||||
|
||||
expect(lastFrame()).toContain('Tips for getting started');
|
||||
@@ -179,10 +167,7 @@ describe('App', () => {
|
||||
|
||||
const { lastFrame, unmount } = await renderWithProviders(<App />, {
|
||||
uiState,
|
||||
settings: createMockSettings({
|
||||
ui: { useAlternateBuffer: true },
|
||||
security: { enablePermanentToolApproval: false },
|
||||
}),
|
||||
settings: createMockSettings({ ui: { useAlternateBuffer: true } }),
|
||||
});
|
||||
|
||||
expect(lastFrame()).toContain(`Press Ctrl+${key} again to exit.`);
|
||||
@@ -195,10 +180,7 @@ describe('App', () => {
|
||||
|
||||
const { lastFrame, unmount } = await renderWithProviders(<App />, {
|
||||
uiState: mockUIState,
|
||||
settings: createMockSettings({
|
||||
ui: { useAlternateBuffer: true },
|
||||
security: { enablePermanentToolApproval: false },
|
||||
}),
|
||||
settings: createMockSettings({ ui: { useAlternateBuffer: true } }),
|
||||
});
|
||||
|
||||
expect(lastFrame()).toContain('Notifications');
|
||||
@@ -213,10 +195,7 @@ describe('App', () => {
|
||||
|
||||
const { lastFrame, unmount } = await renderWithProviders(<App />, {
|
||||
uiState: mockUIState,
|
||||
settings: createMockSettings({
|
||||
ui: { useAlternateBuffer: true },
|
||||
security: { enablePermanentToolApproval: false },
|
||||
}),
|
||||
settings: createMockSettings({ ui: { useAlternateBuffer: true } }),
|
||||
});
|
||||
|
||||
expect(lastFrame()).toContain('Tips for getting started');
|
||||
@@ -268,10 +247,7 @@ describe('App', () => {
|
||||
const { lastFrame, unmount } = await renderWithProviders(<App />, {
|
||||
uiState: stateWithConfirmingTool,
|
||||
config: configWithExperiment,
|
||||
settings: createMockSettings({
|
||||
ui: { useAlternateBuffer: true },
|
||||
security: { enablePermanentToolApproval: false },
|
||||
}),
|
||||
settings: createMockSettings({ ui: { useAlternateBuffer: true } }),
|
||||
});
|
||||
|
||||
expect(lastFrame()).toContain('Tips for getting started');
|
||||
@@ -287,10 +263,7 @@ describe('App', () => {
|
||||
(useIsScreenReaderEnabled as Mock).mockReturnValue(false);
|
||||
const { lastFrame, unmount } = await renderWithProviders(<App />, {
|
||||
uiState: mockUIState,
|
||||
settings: createMockSettings({
|
||||
ui: { useAlternateBuffer: true },
|
||||
security: { enablePermanentToolApproval: false },
|
||||
}),
|
||||
settings: createMockSettings({ ui: { useAlternateBuffer: true } }),
|
||||
});
|
||||
expect(lastFrame()).toMatchSnapshot();
|
||||
unmount();
|
||||
@@ -300,10 +273,7 @@ describe('App', () => {
|
||||
(useIsScreenReaderEnabled as Mock).mockReturnValue(true);
|
||||
const { lastFrame, unmount } = await renderWithProviders(<App />, {
|
||||
uiState: mockUIState,
|
||||
settings: createMockSettings({
|
||||
ui: { useAlternateBuffer: true },
|
||||
security: { enablePermanentToolApproval: false },
|
||||
}),
|
||||
settings: createMockSettings({ ui: { useAlternateBuffer: true } }),
|
||||
});
|
||||
expect(lastFrame()).toMatchSnapshot();
|
||||
unmount();
|
||||
@@ -316,10 +286,7 @@ describe('App', () => {
|
||||
} as UIState;
|
||||
const { lastFrame, unmount } = await renderWithProviders(<App />, {
|
||||
uiState: dialogUIState,
|
||||
settings: createMockSettings({
|
||||
ui: { useAlternateBuffer: true },
|
||||
security: { enablePermanentToolApproval: false },
|
||||
}),
|
||||
settings: createMockSettings({ ui: { useAlternateBuffer: true } }),
|
||||
});
|
||||
expect(lastFrame()).toMatchSnapshot();
|
||||
unmount();
|
||||
|
||||
@@ -158,7 +158,7 @@ describe('Full Terminal Tool Confirmation Snapshot', () => {
|
||||
},
|
||||
},
|
||||
security: {
|
||||
enablePermanentToolApproval: false,
|
||||
enablePermanentToolApproval: true,
|
||||
},
|
||||
},
|
||||
}),
|
||||
|
||||
@@ -203,10 +203,7 @@ describe('ToolConfirmationQueue', () => {
|
||||
/>,
|
||||
{
|
||||
config: mockConfig,
|
||||
settings: createMockSettings({
|
||||
ui: { useAlternateBuffer: false },
|
||||
security: { enablePermanentToolApproval: false },
|
||||
}),
|
||||
settings: createMockSettings({ ui: { useAlternateBuffer: false } }),
|
||||
uiState: {
|
||||
terminalWidth: 80,
|
||||
terminalHeight: 40,
|
||||
|
||||
@@ -4,34 +4,36 @@
|
||||
* 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 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 { renderWithProviders } from '../../../test-utils/render.js';
|
||||
import { createMockSettings } from '../../../test-utils/settings.js';
|
||||
|
||||
describe('ToolConfirmationMessage Redirection', () => {
|
||||
beforeAll(async () => {
|
||||
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 () => {
|
||||
const confirmationDetails: SerializableConfirmationDetails = {
|
||||
type: 'exec',
|
||||
title: 'Confirm execution',
|
||||
title: 'Confirm Shell Command',
|
||||
command: 'echo "hello" > test.txt',
|
||||
rootCommand: 'echo',
|
||||
rootCommand: 'echo, redirection (>)',
|
||||
rootCommands: ['echo'],
|
||||
};
|
||||
|
||||
const mockConfig = {
|
||||
isTrustedFolder: () => true,
|
||||
getIdeMode: () => false,
|
||||
getDisableAlwaysAllow: () => false,
|
||||
getApprovalMode: () => 'default',
|
||||
} as unknown as Config;
|
||||
|
||||
const { lastFrame, unmount } = await renderWithProviders(
|
||||
<ToolConfirmationMessage
|
||||
callId="test-call-id"
|
||||
@@ -42,11 +44,6 @@ describe('ToolConfirmationMessage Redirection', () => {
|
||||
terminalWidth={100}
|
||||
toolName="shell"
|
||||
/>,
|
||||
{
|
||||
settings: createMockSettings({
|
||||
security: { enablePermanentToolApproval: false },
|
||||
}),
|
||||
},
|
||||
);
|
||||
|
||||
const output = lastFrame();
|
||||
|
||||
@@ -419,7 +419,7 @@ describe('ToolConfirmationMessage', () => {
|
||||
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 = {
|
||||
isTrustedFolder: () => true,
|
||||
getIdeMode: () => false,
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// 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. │
|
||||
|
||||
Reference in New Issue
Block a user