scoreBar.spec.jsx 1.4 KB

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