From f91927569c6980a3884674f5f1ab581fcb00f2ce Mon Sep 17 00:00:00 2001 From: Abhi <43648792+abhipatel12@users.noreply.github.com> Date: Mon, 30 Jun 2025 20:28:49 -0400 Subject: refactor(ui): revamp exit stats display (#2771) --- .../cli/src/ui/components/StatsDisplay.test.tsx | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'packages/cli/src/ui/components/StatsDisplay.test.tsx') diff --git a/packages/cli/src/ui/components/StatsDisplay.test.tsx b/packages/cli/src/ui/components/StatsDisplay.test.tsx index 29f322f4..a62815d9 100644 --- a/packages/cli/src/ui/components/StatsDisplay.test.tsx +++ b/packages/cli/src/ui/components/StatsDisplay.test.tsx @@ -260,4 +260,44 @@ describe('', () => { expect(lastFrame()).toMatchSnapshot(); }); }); + + describe('Title Rendering', () => { + const zeroMetrics: SessionMetrics = { + models: {}, + tools: { + totalCalls: 0, + totalSuccess: 0, + totalFail: 0, + totalDurationMs: 0, + totalDecisions: { accept: 0, reject: 0, modify: 0 }, + byName: {}, + }, + }; + + it('renders the default title when no title prop is provided', () => { + const { lastFrame } = renderWithMockedStats(zeroMetrics); + const output = lastFrame(); + expect(output).toContain('Session Stats'); + expect(output).not.toContain('Agent powering down'); + expect(output).toMatchSnapshot(); + }); + + it('renders the custom title when a title prop is provided', () => { + useSessionStatsMock.mockReturnValue({ + stats: { + sessionStartTime: new Date(), + metrics: zeroMetrics, + lastPromptTokenCount: 0, + }, + }); + + const { lastFrame } = render( + , + ); + const output = lastFrame(); + expect(output).toContain('Agent powering down. Goodbye!'); + expect(output).not.toContain('Session Stats'); + expect(output).toMatchSnapshot(); + }); + }); }); -- cgit v1.2.3