organizationRepositories.spec.tsx 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import {render} from 'sentry-test/reactTestingLibrary';
  2. import OrganizationRepositories from 'sentry/views/settings/organizationRepositories/organizationRepositories';
  3. describe('OrganizationRepositories', function () {
  4. const org = TestStubs.Organization();
  5. const router = TestStubs.router();
  6. const location = router.location;
  7. const routerProps = {router, location, routeParams: {}, routes: [], route: {}};
  8. it('renders without providers', function () {
  9. const {container} = render(
  10. <OrganizationRepositories
  11. onRepositoryChange={jest.fn()}
  12. organization={org}
  13. itemList={[]}
  14. {...routerProps}
  15. />
  16. );
  17. expect(container).toSnapshot();
  18. });
  19. it('renders with a repository', function () {
  20. const {container} = render(
  21. <OrganizationRepositories
  22. onRepositoryChange={jest.fn()}
  23. organization={org}
  24. itemList={[TestStubs.Repository()]}
  25. {...routerProps}
  26. />
  27. );
  28. expect(container).toSnapshot();
  29. });
  30. it('renders with a repository and github provider', function () {
  31. const {container} = render(
  32. <OrganizationRepositories
  33. onRepositoryChange={jest.fn()}
  34. organization={org}
  35. itemList={[
  36. TestStubs.Repository({
  37. provider: {id: 'github', name: 'GitHub'},
  38. }),
  39. ]}
  40. {...routerProps}
  41. />
  42. );
  43. expect(container).toSnapshot();
  44. });
  45. });