teamStability.spec.jsx 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import {render, screen} from 'sentry-test/reactTestingLibrary';
  2. import TeamStability from 'sentry/views/organizationStats/teamInsights/teamStability';
  3. describe('TeamStability', () => {
  4. it('should comparse selected past crash rate with current week', () => {
  5. const sessionsApi = MockApiClient.addMockResponse({
  6. url: `/organizations/org-slug/sessions/`,
  7. body: TestStubs.SessionStatusCountByProjectInPeriod(),
  8. });
  9. const project = TestStubs.Project({hasSessions: true, id: 123});
  10. render(
  11. <TeamStability
  12. projects={[project]}
  13. organization={TestStubs.Organization()}
  14. period="7d"
  15. />
  16. );
  17. expect(screen.getByText('project-slug')).toBeInTheDocument();
  18. expect(screen.getAllByText('90%')).toHaveLength(2);
  19. expect(screen.getByText('0%')).toBeInTheDocument(2);
  20. expect(sessionsApi).toHaveBeenCalledTimes(3);
  21. });
  22. it('should render no sessions', () => {
  23. const noSessionProject = TestStubs.Project({hasSessions: false, id: 123});
  24. render(
  25. <TeamStability
  26. projects={[noSessionProject]}
  27. organization={TestStubs.Organization()}
  28. period="7d"
  29. />
  30. );
  31. expect(screen.getAllByText('\u2014')).toHaveLength(3);
  32. });
  33. it('should render no projects', () => {
  34. render(
  35. <TeamStability projects={[]} organization={TestStubs.Organization()} period="7d" />
  36. );
  37. expect(
  38. screen.getByText('No projects with release health enabled')
  39. ).toBeInTheDocument();
  40. });
  41. });