diff options
Diffstat (limited to 'packages/cli/src/services/CommandService.test.ts')
| -rw-r--r-- | packages/cli/src/services/CommandService.test.ts | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/packages/cli/src/services/CommandService.test.ts b/packages/cli/src/services/CommandService.test.ts index 1a62c904..e780ec5f 100644 --- a/packages/cli/src/services/CommandService.test.ts +++ b/packages/cli/src/services/CommandService.test.ts @@ -13,6 +13,7 @@ import { clearCommand } from '../ui/commands/clearCommand.js'; import { authCommand } from '../ui/commands/authCommand.js'; import { themeCommand } from '../ui/commands/themeCommand.js'; import { privacyCommand } from '../ui/commands/privacyCommand.js'; +import { aboutCommand } from '../ui/commands/aboutCommand.js'; // Mock the command modules to isolate the service from the command implementations. vi.mock('../ui/commands/memoryCommand.js', () => ({ @@ -33,6 +34,9 @@ vi.mock('../ui/commands/themeCommand.js', () => ({ vi.mock('../ui/commands/privacyCommand.js', () => ({ privacyCommand: { name: 'privacy', description: 'Mock Privacy' }, })); +vi.mock('../ui/commands/aboutCommand.js', () => ({ + aboutCommand: { name: 'about', description: 'Mock About' }, +})); describe('CommandService', () => { describe('when using default production loader', () => { @@ -58,7 +62,7 @@ describe('CommandService', () => { const tree = commandService.getCommands(); // Post-condition assertions - expect(tree.length).toBe(6); + expect(tree.length).toBe(7); const commandNames = tree.map((cmd) => cmd.name); expect(commandNames).toContain('auth'); @@ -67,19 +71,20 @@ describe('CommandService', () => { expect(commandNames).toContain('clear'); expect(commandNames).toContain('theme'); expect(commandNames).toContain('privacy'); + expect(commandNames).toContain('about'); }); it('should overwrite any existing commands when called again', async () => { // Load once await commandService.loadCommands(); - expect(commandService.getCommands().length).toBe(6); + expect(commandService.getCommands().length).toBe(7); // Load again await commandService.loadCommands(); const tree = commandService.getCommands(); // Should not append, but overwrite - expect(tree.length).toBe(6); + expect(tree.length).toBe(7); }); }); @@ -91,8 +96,9 @@ describe('CommandService', () => { await commandService.loadCommands(); const loadedTree = commandService.getCommands(); - expect(loadedTree.length).toBe(6); + expect(loadedTree.length).toBe(7); expect(loadedTree).toEqual([ + aboutCommand, authCommand, clearCommand, helpCommand, |
