remove hardcoded tiername when missing tier (#21022)

This commit is contained in:
Sehoon Shon
2026-03-03 17:16:37 -05:00
committed by GitHub
parent f3bbe6e77a
commit c70c95ead3
2 changed files with 30 additions and 6 deletions

View File

@@ -47,6 +47,7 @@ describe('<UserIdentity />', () => {
const output = lastFrame();
expect(output).toContain('test@example.com');
expect(output).toContain('/auth');
expect(output).not.toContain('/upgrade');
unmount();
});
@@ -74,6 +75,7 @@ describe('<UserIdentity />', () => {
const output = lastFrame();
expect(output).toContain('Logged in with Google');
expect(output).toContain('/auth');
expect(output).not.toContain('/upgrade');
unmount();
});
@@ -130,6 +132,26 @@ describe('<UserIdentity />', () => {
const output = lastFrame();
expect(output).toContain(`Authenticated with ${AuthType.USE_GEMINI}`);
expect(output).toContain('/auth');
expect(output).not.toContain('/upgrade');
unmount();
});
it('should render specific tier name when provided', async () => {
const mockConfig = makeFakeConfig();
vi.spyOn(mockConfig, 'getContentGeneratorConfig').mockReturnValue({
authType: AuthType.LOGIN_WITH_GOOGLE,
model: 'gemini-pro',
} as unknown as ContentGeneratorConfig);
vi.spyOn(mockConfig, 'getUserTierName').mockReturnValue('Enterprise Tier');
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
<UserIdentity config={mockConfig} />,
);
await waitUntilReady();
const output = lastFrame();
expect(output).toContain('Enterprise Tier');
expect(output).toContain('/upgrade');
unmount();
});
});

View File

@@ -53,12 +53,14 @@ export const UserIdentity: React.FC<UserIdentityProps> = ({ config }) => {
</Box>
{/* Tier Name /upgrade */}
<Box>
<Text color={theme.text.primary} wrap="truncate-end">
{tierName ?? 'Gemini Code Assist for individuals'}
</Text>
<Text color={theme.text.secondary}> /upgrade</Text>
</Box>
{tierName && (
<Box>
<Text color={theme.text.primary} wrap="truncate-end">
{tierName}
</Text>
<Text color={theme.text.secondary}> /upgrade</Text>
</Box>
)}
</Box>
);
};