mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-10-21 11:25:03 +00:00
fix(usage): preserve zero user multipliers in cost details
This commit is contained in:
@@ -497,7 +497,7 @@
|
||||
</div>
|
||||
<div class="flex items-center justify-between gap-6">
|
||||
<span class="text-gray-400">{{ t('usage.rate') }}</span>
|
||||
<span class="font-semibold text-blue-400">{{ formatMultiplier(tooltipData?.rate_multiplier || 1) }}x</span>
|
||||
<span class="font-semibold text-blue-400">{{ formatMultiplier(tooltipData?.rate_multiplier ?? 1) }}x</span>
|
||||
</div>
|
||||
<div class="flex items-center justify-between gap-6">
|
||||
<span class="text-gray-400">{{ t('usage.original') }}</span>
|
||||
|
||||
@@ -225,6 +225,22 @@ describe('admin UsageTable tooltip', () => {
|
||||
expect(wrapper.get('[data-testid="native-compaction-badge"]').text()).toBe('Compaction')
|
||||
})
|
||||
|
||||
it.each([
|
||||
[0, '0.0x'],
|
||||
[0.5, '0.50x'],
|
||||
[undefined, '1.00x'],
|
||||
])('shows the stored user rate %s in cost details', async (rate, expected) => {
|
||||
const wrapper = mount(UsageTable, {
|
||||
props: { data: [{ ...baseImageRow, rate_multiplier: rate }], loading: false, columns: [] },
|
||||
global: { stubs: { DataTable: DataTableStub, EmptyState: true, Icon: true, Teleport: true } },
|
||||
})
|
||||
const triggers = wrapper.findAll('.group.relative')
|
||||
await triggers[triggers.length - 1].trigger('mouseenter')
|
||||
const rateLabel = wrapper.get('.fixed').findAll('span').find(span => span.text() === 'Rate')!
|
||||
expect(rateLabel.element.parentElement?.textContent).toContain(expected)
|
||||
wrapper.unmount()
|
||||
})
|
||||
|
||||
it('shows service tier and billing breakdown in cost tooltip', async () => {
|
||||
const row = {
|
||||
request_id: 'req-admin-1',
|
||||
|
||||
Reference in New Issue
Block a user