summaryrefslogtreecommitdiff
path: root/packages/cli/src/ui/hooks/slashCommandProcessor.test.ts
diff options
context:
space:
mode:
authorAbhi <[email protected]>2025-06-10 15:59:52 -0400
committerGitHub <[email protected]>2025-06-10 15:59:52 -0400
commit9c3f34890f220456235303498736938156d7fefe (patch)
tree463b910e7e4bac945e24748fe19bbb5875d7c8eb /packages/cli/src/ui/hooks/slashCommandProcessor.test.ts
parent04e2fe0bff1dc59d90dd81374a652cccc39dc625 (diff)
feat: Add UI for /stats slash command (#883)
Diffstat (limited to 'packages/cli/src/ui/hooks/slashCommandProcessor.test.ts')
-rw-r--r--packages/cli/src/ui/hooks/slashCommandProcessor.test.ts37
1 files changed, 13 insertions, 24 deletions
diff --git a/packages/cli/src/ui/hooks/slashCommandProcessor.test.ts b/packages/cli/src/ui/hooks/slashCommandProcessor.test.ts
index 7466e2a6..6ec356aa 100644
--- a/packages/cli/src/ui/hooks/slashCommandProcessor.test.ts
+++ b/packages/cli/src/ui/hooks/slashCommandProcessor.test.ts
@@ -255,18 +255,19 @@ describe('useSlashCommandProcessor', () => {
describe('/stats command', () => {
it('should show detailed session statistics', async () => {
// Arrange
+ const cumulativeStats = {
+ totalTokenCount: 900,
+ promptTokenCount: 200,
+ candidatesTokenCount: 400,
+ cachedContentTokenCount: 100,
+ turnCount: 1,
+ toolUsePromptTokenCount: 50,
+ thoughtsTokenCount: 150,
+ };
mockUseSessionStats.mockReturnValue({
stats: {
sessionStartTime: new Date('2025-01-01T00:00:00.000Z'),
- cumulative: {
- totalTokenCount: 900,
- promptTokenCount: 200,
- candidatesTokenCount: 400,
- cachedContentTokenCount: 100,
- turnCount: 1,
- toolUsePromptTokenCount: 50,
- thoughtsTokenCount: 150,
- },
+ cumulative: cumulativeStats,
},
});
@@ -280,24 +281,12 @@ describe('useSlashCommandProcessor', () => {
});
// Assert
- const expectedContent = [
- ` ⎿ Total duration (wall): 1h 2m 3s`,
- ` Total Token usage:`,
- ` Turns: 1`,
- ` Total: 900`,
- ` ├─ Input: 200`,
- ` ├─ Output: 400`,
- ` ├─ Cached: 100`,
- ` └─ Overhead: 200`,
- ` ├─ Model thoughts: 150`,
- ` └─ Tool-use prompts: 50`,
- ].join('\n');
-
expect(mockAddItem).toHaveBeenNthCalledWith(
2, // Called after the user message
expect.objectContaining({
- type: MessageType.INFO,
- text: expectedContent,
+ type: MessageType.STATS,
+ stats: cumulativeStats,
+ duration: '1h 2m 3s',
}),
expect.any(Number),
);