mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-30 07:51:07 -07:00
@@ -37,6 +37,7 @@ describe('upgradeCommand', () => {
|
||||
getContentGeneratorConfig: vi.fn().mockReturnValue({
|
||||
authType: AuthType.LOGIN_WITH_GOOGLE,
|
||||
}),
|
||||
getUserTierName: vi.fn().mockReturnValue(undefined),
|
||||
},
|
||||
},
|
||||
} as unknown as CommandContext);
|
||||
@@ -115,4 +116,23 @@ describe('upgradeCommand', () => {
|
||||
});
|
||||
expect(openBrowserSecurely).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should return info message for ultra tiers', async () => {
|
||||
vi.mocked(mockContext.services.config!.getUserTierName).mockReturnValue(
|
||||
'Advanced Ultra',
|
||||
);
|
||||
|
||||
if (!upgradeCommand.action) {
|
||||
throw new Error('The upgrade command must have an action.');
|
||||
}
|
||||
|
||||
const result = await upgradeCommand.action(mockContext, '');
|
||||
|
||||
expect(result).toEqual({
|
||||
type: 'message',
|
||||
messageType: 'info',
|
||||
content: 'You are already on the highest tier: Advanced Ultra.',
|
||||
});
|
||||
expect(openBrowserSecurely).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
shouldLaunchBrowser,
|
||||
UPGRADE_URL_PAGE,
|
||||
} from '@google/gemini-cli-core';
|
||||
import { isUltraTier } from '../../utils/tierUtils.js';
|
||||
import { CommandKind, type SlashCommand } from './types.js';
|
||||
|
||||
/**
|
||||
@@ -35,6 +36,15 @@ export const upgradeCommand: SlashCommand = {
|
||||
};
|
||||
}
|
||||
|
||||
const tierName = context.services.config?.getUserTierName();
|
||||
if (isUltraTier(tierName)) {
|
||||
return {
|
||||
type: 'message',
|
||||
messageType: 'info',
|
||||
content: `You are already on the highest tier: ${tierName}.`,
|
||||
};
|
||||
}
|
||||
|
||||
if (!shouldLaunchBrowser()) {
|
||||
return {
|
||||
type: 'message',
|
||||
|
||||
Reference in New Issue
Block a user