organizationRepositories.spec.jsx 1.3 KB

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