organizationRepositories.spec.tsx 1.4 KB

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