From c3038178008aeebd773a63e94b05e22fb0bdf9ce Mon Sep 17 00:00:00 2001 From: Developer Date: Wed, 1 Apr 2026 14:41:10 +0800 Subject: [PATCH] test: fix AccountStatusIndicator and AccountUsageCell tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - AccountStatusIndicator: fix i18n key assertion (account.x → admin.accounts.status.x) - AccountUsageCell: fix getUsage mock assertion to include undefined source param --- .../account/__tests__/AccountStatusIndicator.spec.ts | 4 ++-- .../account/__tests__/AccountUsageCell.spec.ts | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/frontend/src/components/account/__tests__/AccountStatusIndicator.spec.ts b/frontend/src/components/account/__tests__/AccountStatusIndicator.spec.ts index 7cdf7999..f758e6b0 100644 --- a/frontend/src/components/account/__tests__/AccountStatusIndicator.spec.ts +++ b/frontend/src/components/account/__tests__/AccountStatusIndicator.spec.ts @@ -122,7 +122,7 @@ describe('AccountStatusIndicator', () => { } }) - expect(wrapper.text()).toContain('account.creditsExhausted') + expect(wrapper.text()).toContain('admin.accounts.status.creditsExhausted') }) it('模型限流 + overages 启用 + AICredits key 生效 → 普通限流样式(积分耗尽,无 ⚡)', () => { @@ -157,6 +157,6 @@ describe('AccountStatusIndicator', () => { expect(wrapper.text()).toContain('CSon45') expect(wrapper.text()).not.toContain('⚡') // AICredits 积分耗尽状态应显示 - expect(wrapper.text()).toContain('account.creditsExhausted') + expect(wrapper.text()).toContain('admin.accounts.status.creditsExhausted') }) }) diff --git a/frontend/src/components/account/__tests__/AccountUsageCell.spec.ts b/frontend/src/components/account/__tests__/AccountUsageCell.spec.ts index 9158da64..ef431759 100644 --- a/frontend/src/components/account/__tests__/AccountUsageCell.spec.ts +++ b/frontend/src/components/account/__tests__/AccountUsageCell.spec.ts @@ -193,7 +193,7 @@ describe('AccountUsageCell', () => { await flushPromises() - expect(getUsage).toHaveBeenCalledWith(2000) + expect(getUsage).toHaveBeenCalledWith(2000, undefined) expect(wrapper.text()).toContain('5h|15|300') expect(wrapper.text()).toContain('7d|77|300') }) @@ -254,7 +254,7 @@ describe('AccountUsageCell', () => { await flushPromises() - expect(getUsage).toHaveBeenCalledWith(2001) + expect(getUsage).toHaveBeenCalledWith(2001, undefined) // 单一数据源:始终使用 /usage API 返回值,忽略 codex 快照 expect(wrapper.text()).toContain('5h|18|900') expect(wrapper.text()).toContain('7d|36|900') @@ -325,7 +325,7 @@ describe('AccountUsageCell', () => { // 手动刷新再拉一次 expect(getUsage).toHaveBeenCalledTimes(2) - expect(getUsage).toHaveBeenCalledWith(2010) + expect(getUsage).toHaveBeenCalledWith(2010, undefined) // 单一数据源:始终使用 /usage API 值 expect(wrapper.text()).toContain('5h|18|900') }) @@ -380,7 +380,7 @@ describe('AccountUsageCell', () => { await flushPromises() - expect(getUsage).toHaveBeenCalledWith(2002) + expect(getUsage).toHaveBeenCalledWith(2002, undefined) expect(wrapper.text()).toContain('5h|0|27700') expect(wrapper.text()).toContain('7d|0|27700') }) @@ -512,7 +512,7 @@ describe('AccountUsageCell', () => { await flushPromises() - expect(getUsage).toHaveBeenCalledWith(2004) + expect(getUsage).toHaveBeenCalledWith(2004, undefined) expect(wrapper.text()).toContain('5h|100|106540000') expect(wrapper.text()).toContain('7d|100|106540000') })