file-view-refresh-error.test.tsx 897 B

12345678910111213141516171819202122232425262728293031
  1. import { render, screen } from '@testing-library/react'
  2. import FileViewRefreshError from '@/features/file-view/components/file-view-refresh-error'
  3. import type { BinaryFile } from '@/features/file-view/types/binary-file'
  4. describe('<FileViewRefreshError />', function () {
  5. it('shows correct error message', function () {
  6. const anotherProjectFile: BinaryFile<'project_file'> = {
  7. id: '123abc',
  8. _id: '123abc',
  9. linkedFileData: {
  10. provider: 'project_file',
  11. source_project_id: 'some-id',
  12. source_entity_path: '/path/',
  13. },
  14. created: new Date(2023, 1, 17, 3, 24),
  15. name: 'frog.jpg',
  16. type: 'file',
  17. selected: true,
  18. hash: '42',
  19. }
  20. render(
  21. <FileViewRefreshError
  22. file={anotherProjectFile}
  23. refreshError="An error message"
  24. />
  25. )
  26. screen.getByText('Access Denied: An error message')
  27. })
  28. })