import { jsx as _jsx } from "react/jsx-runtime";
/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */
import { renderWithProviders } from '../../test-utils/render.js';
import { describe, it, expect, vi } from 'vitest';
import { SessionSummaryDisplay } from './SessionSummaryDisplay.js';
import * as SessionContext from '../contexts/SessionContext.js';
import { ToolCallDecision } from '@google/gemini-cli-core';
vi.mock('../contexts/SessionContext.js', async (importOriginal) => {
    const actual = await importOriginal();
    return {
        ...actual,
        useSessionStats: vi.fn(),
    };
});
const useSessionStatsMock = vi.mocked(SessionContext.useSessionStats);
const renderWithMockedStats = async (metrics) => {
    useSessionStatsMock.mockReturnValue({
        stats: {
            sessionId: 'test-session',
            sessionStartTime: new Date(),
            metrics,
            lastPromptTokenCount: 0,
            promptCount: 5,
        },
        getPromptCount: () => 5,
        startNewPrompt: vi.fn(),
    });
    const result = renderWithProviders(_jsx(SessionSummaryDisplay, { duration: "1h 23m 45s" }), {
        width: 100,
    });
    await result.waitUntilReady();
    return result;
};
describe('<SessionSummaryDisplay />', () => {
    it('renders the summary display with a title', async () => {
        const metrics = {
            models: {
                'gemini-2.5-pro': {
                    api: { totalRequests: 10, totalErrors: 1, totalLatencyMs: 50234 },
                    tokens: {
                        input: 500,
                        prompt: 1000,
                        candidates: 2000,
                        total: 3500,
                        cached: 500,
                        thoughts: 300,
                        tool: 200,
                    },
                    roles: {},
                },
            },
            tools: {
                totalCalls: 0,
                totalSuccess: 0,
                totalFail: 0,
                totalDurationMs: 0,
                totalDecisions: {
                    accept: 0,
                    reject: 0,
                    modify: 0,
                    [ToolCallDecision.AUTO_ACCEPT]: 0,
                },
                byName: {},
            },
            files: {
                totalLinesAdded: 42,
                totalLinesRemoved: 15,
            },
        };
        const { lastFrame, unmount } = await renderWithMockedStats(metrics);
        const output = lastFrame();
        expect(output).toContain('Agent powering down. Goodbye!');
        expect(output).toMatchSnapshot();
        unmount();
    });
});
//# sourceMappingURL=SessionSummaryDisplay.test.js.map