teams.spec.tsx 991 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import {act, render} from 'sentry-test/reactTestingLibrary';
  2. import TeamStore from 'sentry/stores/teamStore';
  3. import Teams from 'sentry/utils/teams';
  4. describe('utils.teams', function () {
  5. const renderer = jest.fn(() => null);
  6. beforeEach(function () {
  7. TeamStore.loadInitialData([
  8. TestStubs.Team({id: '1', slug: 'bar'}),
  9. TestStubs.Team({id: '2', slug: 'foo'}),
  10. ]);
  11. renderer.mockClear();
  12. });
  13. afterEach(function () {
  14. act(() => void TeamStore.loadInitialData([]));
  15. });
  16. it('sends projects to children', function () {
  17. render(<Teams>{renderer}</Teams>);
  18. expect(renderer).toHaveBeenCalledWith(
  19. expect.objectContaining({
  20. fetching: false,
  21. hasMore: null,
  22. fetchError: null,
  23. teams: [
  24. expect.objectContaining({
  25. id: '1',
  26. slug: 'bar',
  27. }),
  28. expect.objectContaining({
  29. id: '2',
  30. slug: 'foo',
  31. }),
  32. ],
  33. })
  34. );
  35. });
  36. });