diff options
Diffstat (limited to 'packages/cli/src/services/CommandService.test.ts')
| -rw-r--r-- | packages/cli/src/services/CommandService.test.ts | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/packages/cli/src/services/CommandService.test.ts b/packages/cli/src/services/CommandService.test.ts index f5a5a835..e479a2ac 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 { themeCommand } from '../ui/commands/themeCommand.js'; // Mock the command modules to isolate the service from the command implementations. vi.mock('../ui/commands/memoryCommand.js', () => ({ @@ -21,6 +22,9 @@ vi.mock('../ui/commands/helpCommand.js', () => ({ vi.mock('../ui/commands/clearCommand.js', () => ({ clearCommand: { name: 'clear', description: 'Mock Clear' }, })); +vi.mock('../ui/commands/themeCommand.js', () => ({ + themeCommand: { name: 'theme', description: 'Mock Theme' }, +})); describe('CommandService', () => { describe('when using default production loader', () => { @@ -46,25 +50,26 @@ describe('CommandService', () => { const tree = commandService.getCommands(); // Post-condition assertions - expect(tree.length).toBe(3); + expect(tree.length).toBe(4); const commandNames = tree.map((cmd) => cmd.name); expect(commandNames).toContain('memory'); expect(commandNames).toContain('help'); expect(commandNames).toContain('clear'); + expect(commandNames).toContain('theme'); }); it('should overwrite any existing commands when called again', async () => { // Load once await commandService.loadCommands(); - expect(commandService.getCommands().length).toBe(3); + expect(commandService.getCommands().length).toBe(4); // Load again await commandService.loadCommands(); const tree = commandService.getCommands(); // Should not append, but overwrite - expect(tree.length).toBe(3); + expect(tree.length).toBe(4); }); }); @@ -76,8 +81,13 @@ describe('CommandService', () => { await commandService.loadCommands(); const loadedTree = commandService.getCommands(); - expect(loadedTree.length).toBe(3); - expect(loadedTree).toEqual([clearCommand, helpCommand, memoryCommand]); + expect(loadedTree.length).toBe(4); + expect(loadedTree).toEqual([ + clearCommand, + helpCommand, + memoryCommand, + themeCommand, + ]); }); }); }); |
