scoreBar.spec.tsx 1.3 KB

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