mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-21 10:34:35 -07:00
feat :rephrasing the extension logging messages to run the explore command when there are no extensions installed (#13740)
This commit is contained in:
@@ -134,6 +134,21 @@ describe('extensionsCommand', () => {
|
||||
expect.any(Number),
|
||||
);
|
||||
});
|
||||
|
||||
it('should show a message if no extensions are installed', async () => {
|
||||
mockGetExtensions.mockReturnValue([]);
|
||||
const command = extensionsCommand();
|
||||
if (!command.action) throw new Error('Action not defined');
|
||||
await command.action(mockContext, '');
|
||||
|
||||
expect(mockContext.ui.addItem).toHaveBeenCalledWith(
|
||||
{
|
||||
type: MessageType.INFO,
|
||||
text: 'No extensions installed. Run `/extensions explore` to check out the gallery.',
|
||||
},
|
||||
expect.any(Number),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('completeExtensions', () => {
|
||||
@@ -216,6 +231,19 @@ describe('extensionsCommand', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('should show a message if no extensions are installed', async () => {
|
||||
mockGetExtensions.mockReturnValue([]);
|
||||
await updateAction(mockContext, 'ext-one');
|
||||
|
||||
expect(mockContext.ui.addItem).toHaveBeenCalledWith(
|
||||
{
|
||||
type: MessageType.INFO,
|
||||
text: 'No extensions installed. Run `/extensions explore` to check out the gallery.',
|
||||
},
|
||||
expect.any(Number),
|
||||
);
|
||||
});
|
||||
|
||||
it('should inform user if there are no extensions to update with --all', async () => {
|
||||
mockDispatchExtensionState.mockImplementationOnce(
|
||||
(action: ExtensionUpdateAction) => {
|
||||
@@ -607,6 +635,25 @@ describe('extensionsCommand', () => {
|
||||
mockContext.invocation!.name = 'restart';
|
||||
});
|
||||
|
||||
it('should show a message if no extensions are installed', async () => {
|
||||
mockContext.services.config!.getExtensionLoader = vi
|
||||
.fn()
|
||||
.mockImplementation(() => ({
|
||||
getExtensions: () => [],
|
||||
restartExtension: mockRestartExtension,
|
||||
}));
|
||||
|
||||
await restartAction!(mockContext, '--all');
|
||||
|
||||
expect(mockContext.ui.addItem).toHaveBeenCalledWith(
|
||||
{
|
||||
type: MessageType.INFO,
|
||||
text: 'No extensions installed. Run `/extensions explore` to check out the gallery.',
|
||||
},
|
||||
expect.any(Number),
|
||||
);
|
||||
});
|
||||
|
||||
it('restarts all active extensions when --all is provided', async () => {
|
||||
const mockExtensions = [
|
||||
{ name: 'ext1', isActive: true },
|
||||
|
||||
Reference in New Issue
Block a user