app.spec.jsx 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import {mountWithTheme} from 'sentry-test/enzyme';
  2. import ConfigStore from 'app/stores/configStore';
  3. import App from 'app/views/app';
  4. describe('App', function () {
  5. beforeEach(function () {
  6. MockApiClient.addMockResponse({
  7. url: '/organizations/',
  8. body: [TestStubs.Organization({slug: 'billy-org', name: 'billy org'})],
  9. });
  10. MockApiClient.addMockResponse({
  11. url: '/internal/health/',
  12. body: {
  13. problems: [],
  14. },
  15. });
  16. MockApiClient.addMockResponse({
  17. url: '/assistant/?v2',
  18. body: [],
  19. });
  20. });
  21. it('renders newsletter consent with flag', async function () {
  22. const user = ConfigStore.get('user');
  23. user.flags.newsletter_consent_prompt = true;
  24. // XXX(dcramer): shouldn't need to re-set
  25. ConfigStore.set('user', user);
  26. const wrapper = mountWithTheme(
  27. <App params={{orgId: 'org-slug'}}>{<div>placeholder content</div>}</App>
  28. );
  29. expect(wrapper.find('NewsletterConsent')).toHaveLength(1);
  30. });
  31. it('does not render newsletter consent without flag', async function () {
  32. const user = ConfigStore.get('user');
  33. user.flags.newsletter_consent_prompt = false;
  34. // XXX(dcramer): shouldn't need to re-set
  35. ConfigStore.set('user', user);
  36. const wrapper = mountWithTheme(
  37. <App params={{orgId: 'org-slug'}}>{<div>placeholder content</div>}</App>
  38. );
  39. expect(wrapper.find('NewsletterConsent')).toHaveLength(0);
  40. });
  41. });