From 6af7a5c58934c9a09774f0d38c3b87c2c877ecc5 Mon Sep 17 00:00:00 2001 From: Abhi <43648792+abhipatel12@users.noreply.github.com> Date: Mon, 16 Jun 2025 02:33:59 -0400 Subject: feat: clear should also clear chat history (#1008) --- .../cli/src/ui/hooks/slashCommandProcessor.test.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'packages/cli/src/ui/hooks/slashCommandProcessor.test.ts') diff --git a/packages/cli/src/ui/hooks/slashCommandProcessor.test.ts b/packages/cli/src/ui/hooks/slashCommandProcessor.test.ts index d9712d6e..68dc3ea9 100644 --- a/packages/cli/src/ui/hooks/slashCommandProcessor.test.ts +++ b/packages/cli/src/ui/hooks/slashCommandProcessor.test.ts @@ -340,6 +340,27 @@ describe('useSlashCommandProcessor', () => { expect(commandResult).toBe(true); }); + it('/clear should clear items, reset chat, and refresh static', async () => { + const mockResetChat = vi.fn(); + mockConfig = { + ...mockConfig, + getGeminiClient: () => ({ + resetChat: mockResetChat, + }), + } as unknown as Config; + + const { handleSlashCommand } = getProcessor(); + let commandResult: SlashCommandActionReturn | boolean = false; + await act(async () => { + commandResult = await handleSlashCommand('/clear'); + }); + + expect(mockClearItems).toHaveBeenCalled(); + expect(mockResetChat).toHaveBeenCalled(); + expect(mockRefreshStatic).toHaveBeenCalled(); + expect(commandResult).toBe(true); + }); + it('/editor should open editor dialog and return true', async () => { const { handleSlashCommand } = getProcessor(); let commandResult: SlashCommandActionReturn | boolean = false; -- cgit v1.2.3