summaryrefslogtreecommitdiff
path: root/packages/cli/src/ui/hooks/slashCommandProcessor.test.ts
diff options
context:
space:
mode:
authorAbhi <[email protected]>2025-06-29 20:44:33 -0400
committerGitHub <[email protected]>2025-06-30 00:44:33 +0000
commit770f862832dfef477705bee69bd2a84397d105a8 (patch)
tree8cb647cf789f05458ff491b461aa531a6932ad3d /packages/cli/src/ui/hooks/slashCommandProcessor.test.ts
parent0fd602eb43eea7abca980dc2ae3fd7bf2ba76a2a (diff)
feat: Change /stats to include more detailed breakdowns (#2615)
Diffstat (limited to 'packages/cli/src/ui/hooks/slashCommandProcessor.test.ts')
-rw-r--r--packages/cli/src/ui/hooks/slashCommandProcessor.test.ts50
1 files changed, 38 insertions, 12 deletions
diff --git a/packages/cli/src/ui/hooks/slashCommandProcessor.test.ts b/packages/cli/src/ui/hooks/slashCommandProcessor.test.ts
index 01954670..d10ae22b 100644
--- a/packages/cli/src/ui/hooks/slashCommandProcessor.test.ts
+++ b/packages/cli/src/ui/hooks/slashCommandProcessor.test.ts
@@ -296,19 +296,9 @@ 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: cumulativeStats,
},
});
@@ -326,7 +316,6 @@ describe('useSlashCommandProcessor', () => {
2, // Called after the user message
expect.objectContaining({
type: MessageType.STATS,
- stats: cumulativeStats,
duration: '1h 2m 3s',
}),
expect.any(Number),
@@ -334,6 +323,44 @@ describe('useSlashCommandProcessor', () => {
vi.useRealTimers();
});
+
+ it('should show model-specific statistics when using /stats model', async () => {
+ // Arrange
+ const { handleSlashCommand } = getProcessor();
+
+ // Act
+ await act(async () => {
+ handleSlashCommand('/stats model');
+ });
+
+ // Assert
+ expect(mockAddItem).toHaveBeenNthCalledWith(
+ 2, // Called after the user message
+ expect.objectContaining({
+ type: MessageType.MODEL_STATS,
+ }),
+ expect.any(Number),
+ );
+ });
+
+ it('should show tool-specific statistics when using /stats tools', async () => {
+ // Arrange
+ const { handleSlashCommand } = getProcessor();
+
+ // Act
+ await act(async () => {
+ handleSlashCommand('/stats tools');
+ });
+
+ // Assert
+ expect(mockAddItem).toHaveBeenNthCalledWith(
+ 2, // Called after the user message
+ expect.objectContaining({
+ type: MessageType.TOOL_STATS,
+ }),
+ expect.any(Number),
+ );
+ });
});
describe('/about command', () => {
@@ -598,7 +625,6 @@ describe('useSlashCommandProcessor', () => {
},
{
type: 'quit',
- stats: expect.any(Object),
duration: '1h 2m 3s',
id: expect.any(Number),
},