notificationSettingsByOrganizations.spec.tsx 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. import {mountWithTheme} from 'sentry-test/enzyme';
  2. import {initializeOrg} from 'sentry-test/initializeOrg';
  3. import {NotificationSettingsObject} from 'sentry/views/settings/account/notifications/constants';
  4. import NotificationSettingsByOrganization from 'sentry/views/settings/account/notifications/notificationSettingsByOrganization';
  5. const createWrapper = (notificationSettings: NotificationSettingsObject) => {
  6. const {organization, routerContext} = initializeOrg();
  7. return mountWithTheme(
  8. <NotificationSettingsByOrganization
  9. notificationType="alerts"
  10. notificationSettings={notificationSettings}
  11. organizations={[organization]}
  12. onChange={jest.fn()}
  13. onSubmitSuccess={jest.fn()}
  14. />,
  15. routerContext
  16. );
  17. };
  18. describe('NotificationSettingsByOrganization', function () {
  19. it('should render', function () {
  20. const wrapper = createWrapper({
  21. alerts: {
  22. user: {me: {email: 'always', slack: 'always'}},
  23. organization: {1: {email: 'always', slack: 'always'}},
  24. },
  25. });
  26. expect(wrapper.find('Select')).toHaveLength(1);
  27. });
  28. });