/** * @license * Copyright 2026 Google LLC * SPDX-License-Identifier: Apache-2.0 */ import { describe, it, expect, vi, afterEach, beforeEach } from 'vitest'; import { renderWithProviders } from '../../test-utils/render.js'; import { Footer } from './Footer.js'; import { createMockSettings } from '../../test-utils/settings.js'; import { type Config } from '@google/gemini-cli-core'; import path from 'node:path'; // Normalize paths to POSIX slashes for stable cross-platform snapshots. const normalizeFrame = (frame: string | undefined) => { if (!frame) return frame; return frame.replace(/\\/g, '/'); }; const { mocks } = vi.hoisted(() => ({ mocks: { isDevelopment: false, }, })); vi.mock('../../utils/installationInfo.js', async (importOriginal) => { const original = await importOriginal(); return { ...original, get isDevelopment() { return mocks.isDevelopment; }, }; }); vi.mock('@google/gemini-cli-core', async (importOriginal) => { const original = await importOriginal(); return { ...original, shortenPath: (p: string, len: number) => { if (p.length > len) { return '...' + p.slice(p.length - len + 3); } return p; }, }; }); const defaultProps = { model: 'gemini-pro', targetDir: path.join( path.parse(process.cwd()).root, 'Users', 'test', 'project', 'foo', 'bar', 'and', 'some', 'more', 'directories', 'to', 'make', 'it', 'long', ), branchName: 'main', }; const mockConfig = { getTargetDir: () => defaultProps.targetDir, getDebugMode: () => false, getModel: () => defaultProps.model, getIdeMode: () => false, isTrustedFolder: () => true, getExtensionRegistryURI: () => undefined, } as unknown as Config; const mockSessionStats = { sessionId: 'test-session-id', sessionStartTime: new Date(), promptCount: 0, lastPromptTokenCount: 150000, metrics: { files: { totalLinesAdded: 12, totalLinesRemoved: 4, }, tools: { count: 0, totalCalls: 0, totalSuccess: 0, totalFail: 0, totalDurationMs: 0, totalDecisions: { accept: 0, reject: 0, modify: 0, auto_accept: 0, }, byName: {}, latency: { avg: 0, max: 0, min: 0 }, }, models: { 'gemini-pro': { api: { totalRequests: 0, totalErrors: 0, totalLatencyMs: 0, }, tokens: { input: 0, prompt: 0, candidates: 0, total: 1500, cached: 0, thoughts: 0, tool: 0, }, roles: {}, }, }, }, }; describe('