releaseStats.spec.jsx 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import {mount} from 'sentry-test/enzyme';
  2. import React from 'react';
  3. import {initializeOrg} from 'sentry-test/initializeOrg';
  4. import ConfigStore from 'app/stores/configStore';
  5. import GroupReleaseStats from 'app/components/group/releaseStats';
  6. describe('GroupReleaseStats', function() {
  7. const {organization, project, routerContext} = initializeOrg();
  8. beforeAll(function() {
  9. // Set timezone for snapshot
  10. ConfigStore.loadInitialData({
  11. user: {
  12. options: {
  13. timezone: 'America/Los_Angeles',
  14. },
  15. },
  16. });
  17. });
  18. const createWrapper = props =>
  19. mount(
  20. <GroupReleaseStats
  21. group={TestStubs.Group()}
  22. project={project}
  23. organization={organization}
  24. allEnvironments={TestStubs.Group()}
  25. environments={[]}
  26. {...props}
  27. />,
  28. routerContext
  29. );
  30. it('renders all environments', function() {
  31. const wrapper = createWrapper();
  32. expect(wrapper.find('[data-test-id="env-label"]').text()).toBe('All Environments');
  33. expect(wrapper.find('GroupReleaseChart')).toHaveLength(2);
  34. expect(wrapper.find('SeenInfo')).toHaveLength(2);
  35. });
  36. it('renders specific environments', function() {
  37. const wrapper = createWrapper({environments: TestStubs.Environments()});
  38. expect(wrapper.find('[data-test-id="env-label"]').text()).toBe('Production, Staging');
  39. expect(wrapper.find('GroupReleaseChart')).toHaveLength(2);
  40. expect(wrapper.find('SeenInfo')).toHaveLength(2);
  41. });
  42. });