scoreBar.spec.jsx 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import React from 'react';
  2. import {shallow} from '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 = shallow(<ScoreBar size={60} thickness={2} score={3} />);
  9. expect(wrapper).toMatchSnapshot();
  10. });
  11. it('renders vertically', function() {
  12. const wrapper = shallow(<ScoreBar size={60} thickness={2} vertical score={2} />);
  13. expect(wrapper).toMatchSnapshot();
  14. });
  15. it('renders with score = 0', function() {
  16. const wrapper = shallow(<ScoreBar size={60} thickness={2} score={0} />);
  17. expect(wrapper).toMatchSnapshot();
  18. });
  19. it('renders with score > max score', function() {
  20. const wrapper = shallow(<ScoreBar size={60} thickness={2} score={10} />);
  21. expect(wrapper).toMatchSnapshot();
  22. });
  23. it('renders with < 0 score', function() {
  24. const wrapper = shallow(<ScoreBar size={60} thickness={2} score={-2} />);
  25. expect(wrapper).toMatchSnapshot();
  26. });
  27. it('has custom palette', function() {
  28. const wrapper = shallow(
  29. <ScoreBar
  30. vertical
  31. size={60}
  32. thickness={2}
  33. score={7}
  34. palette={['white', 'red', 'red', 'pink', 'pink', 'purple', 'purple', 'black']}
  35. />
  36. );
  37. expect(wrapper).toMatchSnapshot();
  38. });
  39. });