releaseStats.spec.jsx 1.5 KB

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