teams.spec.tsx 1017 B

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