Files
supabase/apps/studio/tests/features/reports/storage-report.test.tsx
T
3c588294a6 Improve Integration Test Setup and re-add LogPreviewer tests (#35358)
* fix logs previewer and msw

* refactor api mocking for better dx

* update readme

* comment out error handler for vitest

* rm unnecessary tests

* fix custom render nuqs type

* add logs search test

* rm unnecessary import

* update readme with customRender and customRednerHook

* rm unnecessary api handler

* Move the NODE_ENV to the studio build command in turbo.json.

* Update apps/studio/tests/README.md

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>

* add cursor rule

---------

Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-05-06 09:50:56 +02:00

24 lines
1.0 KiB
TypeScript

import { screen } from '@testing-library/react'
import { test } from 'vitest'
import { StorageReport } from 'pages/project/[ref]/reports/storage'
import { render } from 'tests/helpers'
// [Joshen] Mock data for ApiReport is in __mocks__/hooks/useStorageReport
// 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.skip(`Render static elements`, async () => {
render(<StorageReport dehydratedState={{}} />)
await screen.findByText('Request Caching')
await screen.findByText(/Last 24 hours/)
})
test.skip('Render top cache misses', async () => {
render(<StorageReport dehydratedState={{}} />)
await screen.findAllByText('/storage/v1/object/public/videos/marketing/tabTableEditor.mp4')
await screen.findAllByText('2')
})