From 7a72d255d8effec1396170306cc6be57f598a6d8 Mon Sep 17 00:00:00 2001 From: Abhi <43648792+abhipatel12@users.noreply.github.com> Date: Wed, 11 Jun 2025 16:40:31 -0400 Subject: feat: Add exit UI w/ stats (#924) --- .../ui/components/SessionSummaryDisplay.test.tsx | 52 ++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 packages/cli/src/ui/components/SessionSummaryDisplay.test.tsx (limited to 'packages/cli/src/ui/components/SessionSummaryDisplay.test.tsx') diff --git a/packages/cli/src/ui/components/SessionSummaryDisplay.test.tsx b/packages/cli/src/ui/components/SessionSummaryDisplay.test.tsx new file mode 100644 index 00000000..14d8a277 --- /dev/null +++ b/packages/cli/src/ui/components/SessionSummaryDisplay.test.tsx @@ -0,0 +1,52 @@ +/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +import { render } from 'ink-testing-library'; +import { describe, it, expect } from 'vitest'; +import { SessionSummaryDisplay } from './SessionSummaryDisplay.js'; +import { type CumulativeStats } from '../contexts/SessionContext.js'; + +describe('', () => { + const mockStats: CumulativeStats = { + turnCount: 10, + promptTokenCount: 1000, + candidatesTokenCount: 2000, + totalTokenCount: 3500, + cachedContentTokenCount: 500, + toolUsePromptTokenCount: 200, + thoughtsTokenCount: 300, + apiTimeMs: 50234, + }; + + const mockDuration = '1h 23m 45s'; + + it('renders correctly with given stats and duration', () => { + const { lastFrame } = render( + , + ); + + expect(lastFrame()).toMatchSnapshot(); + }); + + it('renders zero state correctly', () => { + const zeroStats: CumulativeStats = { + turnCount: 0, + promptTokenCount: 0, + candidatesTokenCount: 0, + totalTokenCount: 0, + cachedContentTokenCount: 0, + toolUsePromptTokenCount: 0, + thoughtsTokenCount: 0, + apiTimeMs: 0, + }; + + const { lastFrame } = render( + , + ); + + expect(lastFrame()).toMatchSnapshot(); + }); +}); -- cgit v1.2.3