Version.spec.tsx 870 B

1234567891011121314151617181920212223242526272829
  1. import React from 'react';
  2. import { mount } from 'enzyme';
  3. import Version from 'components/Version/Version';
  4. const tag = 'v1.0.1-SHAPSHOT';
  5. const commit = '123sdf34';
  6. describe('Version', () => {
  7. it('shows nothing if tag is not defined', () => {
  8. const component = mount(<Version />);
  9. expect(component.html()).toEqual(null);
  10. });
  11. it('shows current tag when only tag is defined', () => {
  12. const component = mount(<Version tag={tag} />);
  13. expect(component.text()).toContain(tag);
  14. });
  15. it('shows current tag and commit', () => {
  16. const component = mount(<Version tag={tag} commit={commit} />);
  17. expect(component.text()).toContain(tag);
  18. expect(component.text()).toContain(commit);
  19. });
  20. it('matches snapshot', () => {
  21. const component = mount(<Version tag={tag} commit={commit} />);
  22. expect(component).toMatchSnapshot();
  23. });
  24. });