fix(usage): show retry marker with fallback

This commit is contained in:
Kayphoon
2026-05-23 17:54:48 +08:00
parent babe328565
commit 4ee64339ba
2 changed files with 26 additions and 36 deletions
@@ -74,14 +74,15 @@ vi.mock('lucide-vue-next', async () => {
const { defineComponent, h } = await import('vue')
const Icon = defineComponent({
name: 'IconStub',
setup() {
return () => h('span')
setup(_, { attrs }) {
return () => h('span', attrs)
},
})
return {
RefreshCcw: Icon,
Search: Icon,
Shuffle: Icon,
ChevronDown: Icon,
Check: Icon,
}
@@ -180,7 +181,8 @@ describe('UsageRecordsTable', () => {
.filter((element) => element.textContent?.trim() === '100 tps')
expect(tpsElements.some((element) => element.classList.contains('text-[11px]'))).toBe(false)
const titles = [...root.querySelectorAll<HTMLElement>('[title]')].map((element) => element.title)
const titles = [...root.querySelectorAll<HTMLElement>('[title]')]
.map((element) => element.getAttribute('title'))
expect(titles).toContain([
'首字: 0.50s',
'总耗时: 1.00s',
@@ -271,4 +273,14 @@ describe('UsageRecordsTable', () => {
expect(root.textContent).toContain('Jina Embedding')
expect(root.textContent).toContain('Doubao Embedding')
})
it('shows retry and fallback markers together when both flags are set', () => {
const root = mountUsageRecordsTable([buildRecord({
has_fallback: true,
has_retry: true,
})])
expect(root.querySelector('[data-usage-attempt-marker="fallback"]')).not.toBeNull()
expect(root.querySelector('[data-usage-attempt-marker="retry"]')).not.toBeNull()
})
})