mirror of
https://github.com/supabase/supabase.git
synced 2026-10-17 15:19:08 +03:00
* Add all missing libraries in the packages/apps. * Add all missing Vitest imports to the tests. * Add some missing exports to ui. * Fix the admonition export. * Fix various minor bugs. * Migrate the ui package to use vitest.
36 lines
877 B
TypeScript
36 lines
877 B
TypeScript
import { afterEach, beforeEach, test, vi } from 'vitest'
|
|
|
|
import { screen } from '@testing-library/react'
|
|
import LogEventChart from 'components/interfaces/Settings/Logs/LogEventChart'
|
|
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 },
|
|
{ timestamp: (tsMicro + 1).toString(), count: 2 },
|
|
]}
|
|
onBarClick={mockFn}
|
|
/>
|
|
)
|
|
await screen.findByText(/Logs \/ Time/)
|
|
})
|