storage-report.test.tsx23 lines · main
1import { screen } from '@testing-library/react'
2import { test } from 'vitest'
3
4import { StorageReport } from '@/pages/project/[ref]/observability/storage'
5import { render } from '@/tests/helpers'
6
7// [Joshen] Mock data for ApiReport is in __mocks__/hooks/useStorageReport
8// I don't think this is an ideal set up as the mock data is not clear in this file itself
9// But this is the method that worked for me after hours of wrangling with jest.spyOn and jest.mock
10// which for some reason none of them worked when I was trying to mock the data within the file itself
11// I'd be keen to see how we can do this better if anyone is more familiar to jest 🙏
12
13test.skip(`Render static elements`, async () => {
14 render(<StorageReport dehydratedState={{}} />)
15 await screen.findByText('Request Caching')
16 await screen.findByText(/Last 24 hours/)
17})
18
19test.skip('Render top cache misses', async () => {
20 render(<StorageReport dehydratedState={{}} />)
21 await screen.findAllByText('/storage/v1/object/public/videos/marketing/tabTableEditor.mp4')
22 await screen.findAllByText('2')
23})