deployBadge.spec.jsx 1.1 KB

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