diff options
Diffstat (limited to 'packages/cli/src/services/CommandService.test.ts')
| -rw-r--r-- | packages/cli/src/services/CommandService.test.ts | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/packages/cli/src/services/CommandService.test.ts b/packages/cli/src/services/CommandService.test.ts index c309da34..b1f6e496 100644 --- a/packages/cli/src/services/CommandService.test.ts +++ b/packages/cli/src/services/CommandService.test.ts @@ -10,6 +10,7 @@ import { type SlashCommand } from '../ui/commands/types.js'; import { memoryCommand } from '../ui/commands/memoryCommand.js'; import { helpCommand } from '../ui/commands/helpCommand.js'; import { clearCommand } from '../ui/commands/clearCommand.js'; +import { chatCommand } from '../ui/commands/chatCommand.js'; import { authCommand } from '../ui/commands/authCommand.js'; import { themeCommand } from '../ui/commands/themeCommand.js'; import { statsCommand } from '../ui/commands/statsCommand.js'; @@ -47,6 +48,8 @@ vi.mock('../ui/commands/extensionsCommand.js', () => ({ })); describe('CommandService', () => { + const subCommandLen = 10; + describe('when using default production loader', () => { let commandService: CommandService; @@ -70,13 +73,14 @@ describe('CommandService', () => { const tree = commandService.getCommands(); // Post-condition assertions - expect(tree.length).toBe(9); + expect(tree.length).toBe(subCommandLen); const commandNames = tree.map((cmd) => cmd.name); expect(commandNames).toContain('auth'); expect(commandNames).toContain('memory'); expect(commandNames).toContain('help'); expect(commandNames).toContain('clear'); + expect(commandNames).toContain('chat'); expect(commandNames).toContain('theme'); expect(commandNames).toContain('stats'); expect(commandNames).toContain('privacy'); @@ -87,14 +91,14 @@ describe('CommandService', () => { it('should overwrite any existing commands when called again', async () => { // Load once await commandService.loadCommands(); - expect(commandService.getCommands().length).toBe(9); + expect(commandService.getCommands().length).toBe(subCommandLen); // Load again await commandService.loadCommands(); const tree = commandService.getCommands(); // Should not append, but overwrite - expect(tree.length).toBe(9); + expect(tree.length).toBe(subCommandLen); }); }); @@ -106,10 +110,11 @@ describe('CommandService', () => { await commandService.loadCommands(); const loadedTree = commandService.getCommands(); - expect(loadedTree.length).toBe(9); + expect(loadedTree.length).toBe(subCommandLen); expect(loadedTree).toEqual([ aboutCommand, authCommand, + chatCommand, clearCommand, extensionsCommand, helpCommand, |
