userMisery.spec.jsx 1.3 KB

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