fix(codex): 避免重置机会缺失触发配额刷新

This commit is contained in:
ZheFox
2026-07-16 19:13:09 +08:00
parent f009fb73c3
commit 0099167a6d
3 changed files with 2 additions and 35 deletions
@@ -7,7 +7,6 @@ import {
getCodexResetCreditAvailableCount,
getVisibleCodexResetCreditItems,
mergeCodexQuotaDisplays,
shouldRefreshMissingCodexResetCredits,
} from '@/features/providers/components/codex-reset-credit-display'
import type { QuotaResetCreditsSnapshot } from '@/api/endpoints/types'
@@ -60,21 +59,6 @@ describe('codex reset credit display helpers', () => {
expect(getVisibleCodexResetCreditItems(snapshot, 1_700_000_000)).toEqual([])
})
it('retries missing reset credits only when the cached detail check is stale', () => {
expect(shouldRefreshMissingCodexResetCredits(null, 1_700_000_000)).toBe(true)
expect(shouldRefreshMissingCodexResetCredits({
detail_status: 'failed',
updated_at: 1_699_999_900,
}, 1_700_000_000)).toBe(false)
expect(shouldRefreshMissingCodexResetCredits({
detail_status: 'failed',
updated_at: 1_699_999_600,
}, 1_700_000_000)).toBe(true)
expect(shouldRefreshMissingCodexResetCredits({
available_count: 0,
}, 1_700_000_000)).toBe(false)
})
it('sorts available detail items by remaining time and labels visible items with short ordinal keys', () => {
const snapshot: QuotaResetCreditsSnapshot = {
available_count: 7,