deployBadge.spec.jsx 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import React from 'react';
  2. import {mountWithTheme} from 'sentry-test/enzyme';
  3. import DeployBadge from 'app/components/deployBadge';
  4. const deploy = {
  5. name: '85fedddce5a61a58b160fa6b3d6a1a8451e94eb9 to prod',
  6. url: null,
  7. environment: 'production',
  8. dateStarted: null,
  9. dateFinished: '2020-05-11T18:12:00.025928Z',
  10. id: '6348842',
  11. };
  12. describe('DeployBadge', function() {
  13. it('renders', function() {
  14. const wrapper = mountWithTheme(<DeployBadge deploy={deploy} />);
  15. expect(wrapper.find('Badge').text()).toEqual('production');
  16. expect(wrapper.find('Icon').length).toEqual(0);
  17. });
  18. it('renders with icon and link', function() {
  19. const projectId = 1;
  20. const wrapper = mountWithTheme(
  21. <DeployBadge
  22. deploy={deploy}
  23. orgSlug="sentry"
  24. version="1.2.3"
  25. projectId={projectId}
  26. />
  27. );
  28. expect(wrapper.find('Link').props('to').to).toEqual({
  29. pathname: '/organizations/sentry/issues/',
  30. query: {project: projectId, environment: 'production', query: 'release:1.2.3'},
  31. });
  32. expect(wrapper.find('Badge').text()).toEqual('production');
  33. expect(wrapper.find('Icon').length).toEqual(1);
  34. });
  35. });