fix(core): prioritize detailed error messages for code assist setup (#17852)

This commit is contained in:
Gaurav
2026-02-02 20:27:55 -08:00
committed by GitHub
parent 5b254c379c
commit 1b274b081d
3 changed files with 50 additions and 8 deletions

View File

@@ -312,6 +312,32 @@ describe('setupUser for new user', () => {
userTierName: 'paid',
});
});
it('should throw ineligible tier error when onboarding fails and ineligible tiers exist', async () => {
vi.stubEnv('GOOGLE_CLOUD_PROJECT', '');
mockLoad.mockResolvedValue({
allowedTiers: [mockPaidTier],
ineligibleTiers: [
{
reasonCode: 'UNSUPPORTED_LOCATION',
reasonMessage:
'Your current account is not eligible for Gemini Code Assist for individuals because it is not currently available in your location.',
tierId: 'free-tier',
tierName: 'Gemini Code Assist for individuals',
},
],
});
mockOnboardUser.mockResolvedValue({
done: true,
response: {
cloudaicompanionProject: {},
},
});
await expect(setupUser({} as OAuth2Client)).rejects.toThrow(
'Your current account is not eligible for Gemini Code Assist for individuals because it is not currently available in your location.',
);
});
});
describe('setupUser validation', () => {