scoreBar.spec.jsx 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import {mountWithTheme} from 'sentry-test/enzyme';
  2. import ScoreBar from 'app/components/scoreBar';
  3. describe('ScoreBar', function () {
  4. beforeEach(function () {});
  5. afterEach(function () {});
  6. it('renders', function () {
  7. const wrapper = mountWithTheme(<ScoreBar size={60} thickness={2} score={3} />);
  8. expect(wrapper).toSnapshot();
  9. });
  10. it('renders vertically', function () {
  11. const wrapper = mountWithTheme(
  12. <ScoreBar size={60} thickness={2} vertical score={2} />
  13. );
  14. expect(wrapper).toSnapshot();
  15. });
  16. it('renders with score = 0', function () {
  17. const wrapper = mountWithTheme(<ScoreBar size={60} thickness={2} score={0} />);
  18. expect(wrapper).toSnapshot();
  19. });
  20. it('renders with score > max score', function () {
  21. const wrapper = mountWithTheme(<ScoreBar size={60} thickness={2} score={10} />);
  22. expect(wrapper).toSnapshot();
  23. });
  24. it('renders with < 0 score', function () {
  25. const wrapper = mountWithTheme(<ScoreBar size={60} thickness={2} score={-2} />);
  26. expect(wrapper).toSnapshot();
  27. });
  28. it('has custom palette', function () {
  29. const wrapper = mountWithTheme(
  30. <ScoreBar
  31. vertical
  32. size={60}
  33. thickness={2}
  34. score={7}
  35. palette={['white', 'red', 'red', 'pink', 'pink', 'purple', 'purple', 'black']}
  36. />
  37. );
  38. expect(wrapper).toSnapshot();
  39. });
  40. });