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 a7528b58..1a62c904 100644 --- a/packages/cli/src/services/CommandService.test.ts +++ b/packages/cli/src/services/CommandService.test.ts @@ -12,6 +12,7 @@ import { helpCommand } from '../ui/commands/helpCommand.js'; 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'; // Mock the command modules to isolate the service from the command implementations. vi.mock('../ui/commands/memoryCommand.js', () => ({ @@ -29,6 +30,9 @@ vi.mock('../ui/commands/authCommand.js', () => ({ vi.mock('../ui/commands/themeCommand.js', () => ({ themeCommand: { name: 'theme', description: 'Mock Theme' }, })); +vi.mock('../ui/commands/privacyCommand.js', () => ({ + privacyCommand: { name: 'privacy', description: 'Mock Privacy' }, +})); describe('CommandService', () => { describe('when using default production loader', () => { @@ -54,7 +58,7 @@ describe('CommandService', () => { const tree = commandService.getCommands(); // Post-condition assertions - expect(tree.length).toBe(5); + expect(tree.length).toBe(6); const commandNames = tree.map((cmd) => cmd.name); expect(commandNames).toContain('auth'); @@ -62,19 +66,20 @@ describe('CommandService', () => { expect(commandNames).toContain('help'); expect(commandNames).toContain('clear'); expect(commandNames).toContain('theme'); + expect(commandNames).toContain('privacy'); }); it('should overwrite any existing commands when called again', async () => { // Load once await commandService.loadCommands(); - expect(commandService.getCommands().length).toBe(5); + expect(commandService.getCommands().length).toBe(6); // Load again await commandService.loadCommands(); const tree = commandService.getCommands(); // Should not append, but overwrite - expect(tree.length).toBe(5); + expect(tree.length).toBe(6); }); }); @@ -86,12 +91,13 @@ describe('CommandService', () => { await commandService.loadCommands(); const loadedTree = commandService.getCommands(); - expect(loadedTree.length).toBe(5); + expect(loadedTree.length).toBe(6); expect(loadedTree).toEqual([ authCommand, clearCommand, helpCommand, memoryCommand, + privacyCommand, themeCommand, ]); }); |
