storage-report.test.tsx 1.1 KB

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