mirror of
https://github.com/supabase/supabase.git
synced 2026-10-19 08:09:11 +03:00
* 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 * Replace jest with vitest * Rename all *.test.js to *.test.ts * Configure vitest to work with jsx * fix vitest issues, fix tests, skip broken tests, add msw, add next-router-mock * uncomment file * add tests for msw and nrm * Fix failing tests * fix tests in RowEditor * fix datepicker tests * fix type errors and comment out tests that need some refactoring * leave 1 test so test script works * rm clog and aaaaa * rename script * move msw to studio * add pckg json which i forgot in last commit * rm consolelog * move vitest ui dep * Move next-router-mock to studio. --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com> Co-authored-by: TzeYiing <ty@tzeyiing.com> Co-authored-by: Kamil Ogórek <kamil.ogorek@gmail.com> Co-authored-by: Terry Sutton <saltcod@gmail.com> Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
22 lines
1022 B
TypeScript
22 lines
1022 B
TypeScript
import { prettyDOM, screen } from '@testing-library/react'
|
|
|
|
import { ApiReport } from 'pages/project/[ref]/reports/api-overview'
|
|
import { render } from '../../../helpers'
|
|
|
|
// [Joshen] Mock data for ApiReport is in __mocks__/hooks/useApiReport
|
|
// I don't think this is an ideal set up as the mock data is not clear in this file itself
|
|
// But this is the method that worked for me after hours of wrangling with jest.spyOn and jest.mock
|
|
// which for some reason none of them worked when I was trying to mock the data within the file itself
|
|
// I'd be keen to see how we can do this better if anyone is more familiar to jest 🙏
|
|
|
|
test(`Render static elements`, async () => {
|
|
render(<ApiReport dehydratedState={{}} />)
|
|
await screen.findByText('Total Requests')
|
|
await screen.findByText('Response Errors')
|
|
await screen.findByText('Response Speed')
|
|
await screen.findByText('Network Traffic')
|
|
await screen.findByText(/Last 24 hours/)
|
|
await screen.findByText(/Add filter/)
|
|
await screen.findByText(/All Requests/)
|
|
})
|