Claude plan label: read subscriptionType so a Team seat is not shown as Max 5x (#1492)

* quota: Claude plan label prefers the subscription type

* desktop: Claude plan label prefers the subscription type

* menubar: Claude plan label prefers the subscription type

* mac: Claude plan label prefers the subscription type
This commit is contained in:
Swizzy 2026-09-19 20:25:17 +02:00 • committed by GitHub
parent 14c4a52145
commit 42710db3c2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 195 additions and 55 deletions

View file

@ -1,7 +1,7 @@
import { describe, expect, it, vi } from 'vitest'
import { fetchAntigravityQuota, decodeAntigravitySummary, parseNetstatPorts } from '../src/quota/antigravity.js'
import { decodeClaudeUsage, fetchClaudeQuota } from '../src/quota/claude.js'
import { decodeClaudeUsage, fetchClaudeQuota, planLabel } from '../src/quota/claude.js'
import { decodeCodexUsage, fetchCodexQuota } from '../src/quota/codex.js'
import { decodeCopilotUsage, fetchCopilotQuota } from '../src/quota/copilot.js'
import { decodeGeminiUsage, fetchGeminiQuota } from '../src/quota/gemini.js'
@ -28,6 +28,23 @@ describe('Claude quota', () => {
const result = await fetchClaudeQuota({ fetch: neverFetch as unknown as typeof fetch, readFile: noFile })
expect(result.quota.connection).toBe('disconnected')
})
it('prefers subscriptionType over rateLimitTier for the plan label', () => {
const cases: Array<[string | undefined, string | undefined, string]> = [
['max', 'default_claude_max_20x', 'Max 20x'],
['team', 'default_claude_max_5x', 'Team Premium'],
['team', undefined, 'Team'],
['enterprise', 'default_claude_max_5x', 'Enterprise Premium'],
['pro', 'default_claude_pro', 'Pro'],
[undefined, 'max_5x', 'Max 5x'],
[undefined, 'max_20x', 'Max 20x'],
[undefined, 'team', 'Team'],
[undefined, undefined, 'Subscription'],
]
for (const [subscriptionType, rateLimitTier, label] of cases) {
expect(planLabel({ subscriptionType, rateLimitTier })).toBe(label)
}
})
})
describe('Codex quota', () => {