diff options
| author | Abhi <[email protected]> | 2025-06-30 20:28:49 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-07-01 00:28:49 +0000 |
| commit | f91927569c6980a3884674f5f1ab581fcb00f2ce (patch) | |
| tree | 5f551cb4d2c5411142c7c3db43d6a5f7e4458825 /packages/cli/src/ui/components/StatsDisplay.test.tsx | |
| parent | 3587054d32372874a4e067ae050f861ad1cec2b4 (diff) | |
refactor(ui): revamp exit stats display (#2771)
Diffstat (limited to 'packages/cli/src/ui/components/StatsDisplay.test.tsx')
| -rw-r--r-- | packages/cli/src/ui/components/StatsDisplay.test.tsx | 40 |
1 files changed, 40 insertions, 0 deletions
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('<StatsDisplay />', () => { 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( + <StatsDisplay duration="1s" title="Agent powering down. Goodbye!" />, + ); + const output = lastFrame(); + expect(output).toContain('Agent powering down. Goodbye!'); + expect(output).not.toContain('Session Stats'); + expect(output).toMatchSnapshot(); + }); + }); }); |
