organizationRepositories.spec.jsx 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import React from 'react';
  2. import {shallow} from 'enzyme';
  3. import {Client} from 'app/api';
  4. import OrganizationRepositories from 'app/views/settings/organization/repositories/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()]}}
  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. params={{orgId: 'org-slug'}}
  34. repoConfig={{providers: [TestStubs.GitHubRepositoryProvider()]}}
  35. itemList={[TestStubs.Repository()]}
  36. />
  37. );
  38. expect(wrapper).toMatchSnapshot();
  39. });
  40. });