organizationRepositories.spec.jsx 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import {mountWithTheme} from 'sentry-test/enzyme';
  2. import {Client} from 'sentry/api';
  3. import OrganizationRepositories from 'sentry/views/settings/organizationRepositories/organizationRepositories';
  4. describe('OrganizationRepositories', function () {
  5. it('renders without providers', function () {
  6. const wrapper = mountWithTheme(
  7. <OrganizationRepositories
  8. params={{orgId: 'org-slug'}}
  9. itemList={[]}
  10. repoConfig={{}}
  11. />
  12. );
  13. expect(wrapper).toSnapshot();
  14. });
  15. it('renders with github provider', function () {
  16. const wrapper = mountWithTheme(
  17. <OrganizationRepositories
  18. params={{orgId: 'org-slug'}}
  19. repoConfig={{providers: [TestStubs.GitHubRepositoryProvider({id: 'github'})]}}
  20. itemList={[]}
  21. />
  22. );
  23. expect(wrapper).toSnapshot();
  24. });
  25. it('renders with a repository', function () {
  26. Client.addMockResponse({
  27. url: '/organizations/org-slug/repos/',
  28. body: [TestStubs.Repository()],
  29. });
  30. const wrapper = mountWithTheme(
  31. <OrganizationRepositories
  32. api={new Client()}
  33. params={{orgId: 'org-slug'}}
  34. repoConfig={{providers: [TestStubs.GitHubRepositoryProvider({id: 'github'})]}}
  35. itemList={[TestStubs.Repository()]}
  36. />
  37. );
  38. expect(wrapper).toSnapshot();
  39. });
  40. });