projectPlugins.spec.jsx 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import {mountWithTheme} from 'sentry-test/enzyme';
  2. import ProjectPlugins from 'sentry/views/settings/projectPlugins/projectPlugins';
  3. describe('ProjectPlugins', function () {
  4. let wrapper;
  5. const plugins = TestStubs.Plugins();
  6. const org = TestStubs.Organization();
  7. const project = TestStubs.Project();
  8. const params = {
  9. orgId: org.slug,
  10. projectId: project.slug,
  11. };
  12. it('renders', function () {
  13. wrapper = mountWithTheme(<ProjectPlugins params={params} plugins={plugins} />);
  14. expect(wrapper).toSnapshot();
  15. });
  16. it('has loading state', function () {
  17. wrapper = mountWithTheme(<ProjectPlugins params={params} loading plugins={[]} />);
  18. expect(wrapper.find('LoadingIndicator')).toHaveLength(1);
  19. });
  20. it('has error state when plugins=null and loading is true', function () {
  21. wrapper = mountWithTheme(
  22. <ProjectPlugins
  23. params={params}
  24. plugins={null}
  25. loading
  26. error={new Error('An error')}
  27. />
  28. );
  29. expect(wrapper.find('RouteError')).toHaveLength(1);
  30. });
  31. it('has error state when plugins=[]', function () {
  32. wrapper = mountWithTheme(
  33. <ProjectPlugins
  34. params={params}
  35. plugins={[]}
  36. loading
  37. error={new Error('An error')}
  38. />
  39. );
  40. expect(wrapper.find('RouteError')).toHaveLength(1);
  41. });
  42. });