userMisery.spec.tsx 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import {render, screen} from 'sentry-test/reactTestingLibrary';
  2. import UserMisery from 'sentry/components/userMisery';
  3. describe('UserMisery', function () {
  4. it('renders no bars when user misery is less than 0.05', function () {
  5. render(
  6. <UserMisery
  7. bars={10}
  8. barHeight={20}
  9. userMisery={0.04}
  10. miseryLimit={300}
  11. miserableUsers={0}
  12. totalUsers={100}
  13. />
  14. );
  15. expect(screen.getByTestId('score-bar-0')).toBeInTheDocument();
  16. });
  17. it('renders no bars when user misery is equal to 0.05', function () {
  18. render(
  19. <UserMisery
  20. bars={10}
  21. barHeight={20}
  22. userMisery={0.05}
  23. miseryLimit={300}
  24. miserableUsers={1}
  25. totalUsers={100}
  26. />
  27. );
  28. expect(screen.getByTestId('score-bar-0')).toBeInTheDocument();
  29. });
  30. it('renders one bar when user misery is greater than 0.05', function () {
  31. render(
  32. <UserMisery
  33. bars={10}
  34. barHeight={20}
  35. userMisery={0.06}
  36. miseryLimit={300}
  37. miserableUsers={1}
  38. totalUsers={100}
  39. />
  40. );
  41. expect(screen.getByTestId('score-bar-1')).toBeInTheDocument();
  42. });
  43. });