mirror of
https://github.com/supabase/supabase.git
synced 2026-05-07 23:19:23 +08:00
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
26 lines
770 B
TypeScript
26 lines
770 B
TypeScript
import { describe, expect, it } from 'vitest'
|
|
|
|
import { formatDuration } from './QueryPerformance.utils'
|
|
|
|
describe('formatDuration', () => {
|
|
it('should format seconds', () => {
|
|
expect(formatDuration(1000)).toBe('1.00s')
|
|
expect(formatDuration(30000)).toBe('30.00s')
|
|
})
|
|
|
|
it('should format minutes and seconds', () => {
|
|
expect(formatDuration(60000)).toBe('1m')
|
|
expect(formatDuration(125000)).toBe('2m 5s')
|
|
})
|
|
|
|
it('should format hours, minutes and seconds', () => {
|
|
expect(formatDuration(3600000)).toBe('1h')
|
|
expect(formatDuration(3661000)).toBe('1h 1m 1s')
|
|
})
|
|
|
|
it('should format days, hours, minutes and seconds', () => {
|
|
expect(formatDuration(86400000)).toBe('1d')
|
|
expect(formatDuration(90061000)).toBe('1d 1h 1m 1s')
|
|
})
|
|
})
|