mirror of
https://github.com/supabase/supabase.git
synced 2026-10-19 08:09:11 +03:00
36 lines
884 B
TypeScript
36 lines
884 B
TypeScript
import { vi } from 'vitest'
|
|
|
|
import LogEventChart from 'components/interfaces/Settings/Logs/LogEventChart'
|
|
import { screen } from '@testing-library/react'
|
|
import { render } from '../../helpers'
|
|
|
|
const { ResizeObserver } = window
|
|
|
|
beforeEach(() => {
|
|
delete (window as any).ResizeObserver
|
|
window.ResizeObserver = vi.fn().mockImplementation(() => ({
|
|
observe: vi.fn(),
|
|
unobserve: vi.fn(),
|
|
disconnect: vi.fn(),
|
|
}))
|
|
})
|
|
|
|
afterEach(() => {
|
|
window.ResizeObserver = ResizeObserver
|
|
})
|
|
|
|
test('renders chart', async () => {
|
|
const mockFn = vi.fn()
|
|
const tsMicro = new Date().getTime() * 1000
|
|
render(
|
|
<LogEventChart
|
|
data={[
|
|
{ timestamp: tsMicro.toString(), count: 1, has_error: false },
|
|
{ timestamp: (tsMicro + 1).toString(), count: 2, has_error: false },
|
|
]}
|
|
onBarClick={mockFn}
|
|
/>
|
|
)
|
|
await screen.findByText(/Logs \/ Time/)
|
|
})
|