feat(ui): Do not show Ultra users /upgrade hint (#22154) (#22156)

This commit is contained in:
Sehoon Shon
2026-03-12 09:46:58 -04:00
committed by GitHub
parent 45faf4d31b
commit 18e8dd768a
9 changed files with 137 additions and 2 deletions

View File

@@ -0,0 +1,28 @@
/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, expect, it } from 'vitest';
import { isUltraTier } from './tierUtils.js';
describe('tierUtils', () => {
describe('isUltraTier', () => {
it('should return true if tier name contains "ultra" (case-insensitive)', () => {
expect(isUltraTier('Advanced Ultra')).toBe(true);
expect(isUltraTier('gemini ultra')).toBe(true);
expect(isUltraTier('ULTRA')).toBe(true);
});
it('should return false if tier name does not contain "ultra"', () => {
expect(isUltraTier('Free')).toBe(false);
expect(isUltraTier('Pro')).toBe(false);
expect(isUltraTier('Standard')).toBe(false);
});
it('should return false if tier name is undefined', () => {
expect(isUltraTier(undefined)).toBe(false);
});
});
});

View File

@@ -0,0 +1,15 @@
/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
/**
* Checks if the given tier name corresponds to an "Ultra" tier.
*
* @param tierName The name of the user's tier.
* @returns True if the tier is an "Ultra" tier, false otherwise.
*/
export function isUltraTier(tierName?: string): boolean {
return !!tierName?.toLowerCase().includes('ultra');
}