test: fix AccountStatusIndicator and AccountUsageCell tests
Some checks failed
CI / test (push) Has been cancelled
CI / golangci-lint (push) Has been cancelled
Security Scan / backend-security (push) Has been cancelled
Security Scan / frontend-security (push) Has been cancelled

- AccountStatusIndicator: fix i18n key assertion (account.x → admin.accounts.status.x)
- AccountUsageCell: fix getUsage mock assertion to include undefined source param
This commit is contained in:
Developer
2026-04-01 14:41:10 +08:00
parent 6b060dd14d
commit c303817800
2 changed files with 7 additions and 7 deletions

View File

@@ -122,7 +122,7 @@ describe('AccountStatusIndicator', () => {
} }
}) })
expect(wrapper.text()).toContain('account.creditsExhausted') expect(wrapper.text()).toContain('admin.accounts.status.creditsExhausted')
}) })
it('模型限流 + overages 启用 + AICredits key 生效 → 普通限流样式(积分耗尽,无 ⚡)', () => { it('模型限流 + overages 启用 + AICredits key 生效 → 普通限流样式(积分耗尽,无 ⚡)', () => {
@@ -157,6 +157,6 @@ describe('AccountStatusIndicator', () => {
expect(wrapper.text()).toContain('CSon45') expect(wrapper.text()).toContain('CSon45')
expect(wrapper.text()).not.toContain('⚡') expect(wrapper.text()).not.toContain('⚡')
// AICredits 积分耗尽状态应显示 // AICredits 积分耗尽状态应显示
expect(wrapper.text()).toContain('account.creditsExhausted') expect(wrapper.text()).toContain('admin.accounts.status.creditsExhausted')
}) })
}) })

View File

@@ -193,7 +193,7 @@ describe('AccountUsageCell', () => {
await flushPromises() await flushPromises()
expect(getUsage).toHaveBeenCalledWith(2000) expect(getUsage).toHaveBeenCalledWith(2000, undefined)
expect(wrapper.text()).toContain('5h|15|300') expect(wrapper.text()).toContain('5h|15|300')
expect(wrapper.text()).toContain('7d|77|300') expect(wrapper.text()).toContain('7d|77|300')
}) })
@@ -254,7 +254,7 @@ describe('AccountUsageCell', () => {
await flushPromises() await flushPromises()
expect(getUsage).toHaveBeenCalledWith(2001) expect(getUsage).toHaveBeenCalledWith(2001, undefined)
// 单一数据源:始终使用 /usage API 返回值,忽略 codex 快照 // 单一数据源:始终使用 /usage API 返回值,忽略 codex 快照
expect(wrapper.text()).toContain('5h|18|900') expect(wrapper.text()).toContain('5h|18|900')
expect(wrapper.text()).toContain('7d|36|900') expect(wrapper.text()).toContain('7d|36|900')
@@ -325,7 +325,7 @@ describe('AccountUsageCell', () => {
// 手动刷新再拉一次 // 手动刷新再拉一次
expect(getUsage).toHaveBeenCalledTimes(2) expect(getUsage).toHaveBeenCalledTimes(2)
expect(getUsage).toHaveBeenCalledWith(2010) expect(getUsage).toHaveBeenCalledWith(2010, undefined)
// 单一数据源:始终使用 /usage API 值 // 单一数据源:始终使用 /usage API 值
expect(wrapper.text()).toContain('5h|18|900') expect(wrapper.text()).toContain('5h|18|900')
}) })
@@ -380,7 +380,7 @@ describe('AccountUsageCell', () => {
await flushPromises() await flushPromises()
expect(getUsage).toHaveBeenCalledWith(2002) expect(getUsage).toHaveBeenCalledWith(2002, undefined)
expect(wrapper.text()).toContain('5h|0|27700') expect(wrapper.text()).toContain('5h|0|27700')
expect(wrapper.text()).toContain('7d|0|27700') expect(wrapper.text()).toContain('7d|0|27700')
}) })
@@ -512,7 +512,7 @@ describe('AccountUsageCell', () => {
await flushPromises() await flushPromises()
expect(getUsage).toHaveBeenCalledWith(2004) expect(getUsage).toHaveBeenCalledWith(2004, undefined)
expect(wrapper.text()).toContain('5h|100|106540000') expect(wrapper.text()).toContain('5h|100|106540000')
expect(wrapper.text()).toContain('7d|100|106540000') expect(wrapper.text()).toContain('7d|100|106540000')
}) })