mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-11 22:00:41 -07:00
[Extension Reloading]: Update custom commands, add enable/disable command (#12547)
This commit is contained in:
@@ -26,6 +26,7 @@ import {
|
||||
ToolConfirmationOutcome,
|
||||
makeFakeConfig,
|
||||
} from '@google/gemini-cli-core';
|
||||
import { appEvents } from '../../utils/events.js';
|
||||
|
||||
const { logSlashCommand } = vi.hoisted(() => ({
|
||||
logSlashCommand: vi.fn(),
|
||||
@@ -1076,4 +1077,26 @@ describe('useSlashCommandProcessor', () => {
|
||||
expect(logSlashCommand).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
it('should reload commands on extension events', async () => {
|
||||
const result = await setupProcessorHook();
|
||||
await waitFor(() => expect(result.current.slashCommands).toEqual([]));
|
||||
|
||||
// Create a new command and make that the result of the fileLoadCommands
|
||||
// (which is where extension commands come from)
|
||||
const newCommand = createTestCommand({
|
||||
name: 'someNewCommand',
|
||||
action: vi.fn(),
|
||||
});
|
||||
mockFileLoadCommands.mockResolvedValue([newCommand]);
|
||||
|
||||
// We should not see a change until we fire an event.
|
||||
await waitFor(() => expect(result.current.slashCommands).toEqual([]));
|
||||
await act(() => {
|
||||
appEvents.emit('extensionsStarting');
|
||||
});
|
||||
await waitFor(() =>
|
||||
expect(result.current.slashCommands).toEqual([newCommand]),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user