/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */ import { render } from 'ink-testing-library'; import { describe, it, expect, vi } from 'vitest'; import { ToolConfirmationMessage } from './ToolConfirmationMessage.js'; import { ToolCallConfirmationDetails } from '@gemini-cli/core'; describe('ToolConfirmationMessage', () => { it('should not display urls if prompt and url are the same', () => { const confirmationDetails: ToolCallConfirmationDetails = { type: 'info', title: 'Confirm Web Fetch', prompt: 'https://example.com', urls: ['https://example.com'], onConfirm: vi.fn(), }; const { lastFrame } = render( , ); expect(lastFrame()).not.toContain('URLs to fetch:'); }); it('should display urls if prompt and url are different', () => { const confirmationDetails: ToolCallConfirmationDetails = { type: 'info', title: 'Confirm Web Fetch', prompt: 'fetch https://github.com/google/gemini-react/blob/main/README.md', urls: [ 'https://raw.githubusercontent.com/google/gemini-react/main/README.md', ], onConfirm: vi.fn(), }; const { lastFrame } = render( , ); expect(lastFrame()).toContain('URLs to fetch:'); expect(lastFrame()).toContain( '- https://raw.githubusercontent.com/google/gemini-react/main/README.md', ); }); });