peopleSection.spec.tsx 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import {TeamFixture} from 'sentry-fixture/team';
  2. import {UserFixture} from 'sentry-fixture/user';
  3. import {render, screen} from 'sentry-test/reactTestingLibrary';
  4. import type {TeamParticipant, UserParticipant} from 'sentry/types/group';
  5. import PeopleSection from 'sentry/views/issueDetails/streamline/sidebar/peopleSection';
  6. describe('PeopleSection', () => {
  7. const teams: TeamParticipant[] = [{...TeamFixture(), type: 'team'}];
  8. const users: UserParticipant[] = [
  9. {
  10. ...UserFixture({
  11. id: '2',
  12. name: 'John Smith',
  13. email: 'johnsmith@example.com',
  14. }),
  15. type: 'user',
  16. },
  17. {
  18. ...UserFixture({
  19. id: '3',
  20. name: 'Sohn Jmith',
  21. email: 'sohnjmith@example.com',
  22. }),
  23. type: 'user',
  24. },
  25. ];
  26. it('displays participants and viewers', async () => {
  27. render(
  28. <PeopleSection teamParticipants={teams} userParticipants={users} viewers={users} />
  29. );
  30. expect(await screen.findByText('participating')).toBeInTheDocument();
  31. expect(await screen.findByText('viewed')).toBeInTheDocument();
  32. });
  33. it('does not display particiapnts if there are none', () => {
  34. render(<PeopleSection teamParticipants={[]} userParticipants={[]} viewers={users} />);
  35. expect(screen.queryByText('participating')).not.toBeInTheDocument();
  36. });
  37. });