Files
supabase/apps/studio/components/interfaces/Functions/EdgeFunctionsListItem.utils.test.ts
Saxon Fletcher 3f6cd1f188 error rates in functions list (#44006)
<img width="1835" height="886" alt="image"
src="https://github.com/user-attachments/assets/c4ab5be6-cddc-49b3-8d09-169acb706a20"
/>

Adds total request and error rate columns to edge functions table behind
a feature flag

---------

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: SaxonF <1072756+SaxonF@users.noreply.github.com>
Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2026-03-25 17:23:46 +08:00

26 lines
863 B
TypeScript

import { describe, expect, it } from 'vitest'
import { formatErrorRate } from './EdgeFunctionsListItem.utils'
describe('formatErrorRate', () => {
it.each([
{ value: 0, expected: '0%' },
{ value: 100, expected: '100%' },
{ value: 101, expected: '100%' },
{ value: 200, expected: '100%' },
{ value: 0.05, expected: '<0.1%' },
{ value: 0.001, expected: '<0.1%' },
{ value: 0.099, expected: '<0.1%' },
{ value: 0.1, expected: '0.1%' },
{ value: 1.0, expected: '1.0%' },
{ value: 1.567, expected: '1.6%' },
{ value: 50, expected: '50.0%' },
{ value: 99.9, expected: '99.9%' },
{ value: 99.99, expected: '100%' },
{ value: 1.55, expected: '1.6%' },
{ value: 1.54, expected: '1.5%' },
])('formats $value as $expected', ({ value, expected }) => {
expect(formatErrorRate(value)).toBe(expected)
})
})