Files
supabase/apps/studio/tests/pages/projects/LogEventChart.test.js
T
Joshen LimandTzeYiing d025e0f739 chore/fix studio jest tests (#25872)
* Fix tests in tests/unit, tests/components and files under tests, looking into tests/pages

* Fix tests under pages/projects root

* Fix

* Comment out broken tests that im stuck with

* Fix api-report.test

* Fix storage-report-test

* chore: fix some tests

* chore: remove logging

* Fix LogsPreviewer.test.js

* Fix most of logs-query-test

* Skip broken tests instead of false positiving them

---------

Co-authored-by: TzeYiing <ty@tzeyiing.com>
2024-05-11 12:05:25 +02:00

32 lines
776 B
JavaScript

import LogEventChart from 'components/interfaces/Settings/Logs/LogEventChart'
import { screen } from '@testing-library/react'
import { render } from '../../helpers'
const { ResizeObserver } = window
beforeEach(() => {
delete window.ResizeObserver
window.ResizeObserver = jest.fn().mockImplementation(() => ({
observe: jest.fn(),
unobserve: jest.fn(),
disconnect: jest.fn(),
}))
})
afterEach(() => {
window.ResizeObserver = ResizeObserver
jest.restoreAllMocks()
})
test('renders chart', async () => {
const mockFn = jest.fn()
const tsMicro = new Date().getTime() * 1000
render(
<LogEventChart
data={[{ timestamp: tsMicro }, { timestamp: tsMicro + 1 }]}
onBarClick={mockFn}
/>
)
await screen.findByText(/Logs \/ Time/)
})