|
@@ -1,31 +1,30 @@
|
|
|
-import {mountWithTheme} from 'sentry-test/enzyme';
|
|
|
import {initializeOrg} from 'sentry-test/initializeOrg';
|
|
|
+import {render, screen} from 'sentry-test/reactTestingLibrary';
|
|
|
|
|
|
-import {NotificationSettingsObject} from 'sentry/views/settings/account/notifications/constants';
|
|
|
import NotificationSettingsByOrganization from 'sentry/views/settings/account/notifications/notificationSettingsByOrganization';
|
|
|
|
|
|
-const createWrapper = (notificationSettings: NotificationSettingsObject) => {
|
|
|
- const {organization, routerContext} = initializeOrg();
|
|
|
- return mountWithTheme(
|
|
|
- <NotificationSettingsByOrganization
|
|
|
- notificationType="alerts"
|
|
|
- notificationSettings={notificationSettings}
|
|
|
- organizations={[organization]}
|
|
|
- onChange={jest.fn()}
|
|
|
- onSubmitSuccess={jest.fn()}
|
|
|
- />,
|
|
|
- routerContext
|
|
|
- );
|
|
|
-};
|
|
|
-
|
|
|
describe('NotificationSettingsByOrganization', function () {
|
|
|
it('should render', function () {
|
|
|
- const wrapper = createWrapper({
|
|
|
+ const settings = {
|
|
|
alerts: {
|
|
|
user: {me: {email: 'always', slack: 'always'}},
|
|
|
organization: {1: {email: 'always', slack: 'always'}},
|
|
|
},
|
|
|
- });
|
|
|
- expect(wrapper.find('Select')).toHaveLength(1);
|
|
|
+ };
|
|
|
+
|
|
|
+ const {organization, routerContext} = initializeOrg();
|
|
|
+
|
|
|
+ render(
|
|
|
+ <NotificationSettingsByOrganization
|
|
|
+ notificationType="alerts"
|
|
|
+ notificationSettings={settings}
|
|
|
+ organizations={[organization]}
|
|
|
+ onChange={jest.fn()}
|
|
|
+ onSubmitSuccess={jest.fn()}
|
|
|
+ />,
|
|
|
+ {context: routerContext}
|
|
|
+ );
|
|
|
+
|
|
|
+ expect(screen.getByRole('textbox', {name: 'org-slug'})).toBeInTheDocument();
|
|
|
});
|
|
|
});
|