diff --git a/dashboards-notifications/public/pages/CreateChannel/__tests__/CreateChannel.test.tsx b/dashboards-notifications/public/pages/CreateChannel/__tests__/CreateChannel.test.tsx
index 2078bcdd..a2f23290 100644
--- a/dashboards-notifications/public/pages/CreateChannel/__tests__/CreateChannel.test.tsx
+++ b/dashboards-notifications/public/pages/CreateChannel/__tests__/CreateChannel.test.tsx
@@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
-import { render, waitFor } from '@testing-library/react';
+import { render, screen, waitFor } from '@testing-library/react';
import React from 'react';
import { RouteComponentProps } from 'react-router-dom';
import { MOCK_DATA } from '../../../../test/mocks/mockData';
@@ -42,6 +42,52 @@ describe(' spec', () => {
expect(utils.container.firstChild).toMatchSnapshot();
});
+ it('renders the component without SMTP sender type', async () => {
+ const notificationServiceMockEmail = jest.fn() as any;
+ const getEmailChannel = jest.fn(
+ async (queryObject: object) => MOCK_DATA.email
+ );
+ notificationServiceMockEmail.notificationService = {
+ getChannel: getEmailChannel,
+ getSenders: jest.fn(async (query) => MOCK_DATA.senders),
+ getEmailConfigDetails: jest.fn(async (channel) =>
+ Promise.resolve(channel)
+ ),
+ updateConfig: updateConfigSuccess,
+ };
+ const props = {
+ location: { search: '' },
+ match: { params: { id: 'test' } },
+ };
+ const mainState = { ...mainStateMock,
+ availableConfigTypes: [
+ 'slack',
+ 'chime',
+ 'webhook',
+ 'email',
+ 'sns',
+ 'ses_account',
+ 'email_group',
+ ],
+ };
+
+ render(
+
+
+
+ )}
+ edit={true}
+ />
+
+
+
+ );
+
+ expect(await screen.queryByText('Sender type')).toBeNull();
+ expect(await screen.queryByText('SMTP sender')).toBeNull();
+ });
+
it('renders the component for editing slack', async () => {
const notificationServiceMockSlack = jest.fn() as any;
const getSlackChannel = jest.fn(
diff --git a/dashboards-notifications/public/pages/CreateChannel/components/EmailSettings.tsx b/dashboards-notifications/public/pages/CreateChannel/components/EmailSettings.tsx
index 7c1e7c09..9565b68d 100644
--- a/dashboards-notifications/public/pages/CreateChannel/components/EmailSettings.tsx
+++ b/dashboards-notifications/public/pages/CreateChannel/components/EmailSettings.tsx
@@ -159,7 +159,7 @@ export function EmailSettings(props: EmailSettingsProps) {
0}
>
@@ -221,7 +221,7 @@ export function EmailSettings(props: EmailSettingsProps) {
0}
>
diff --git a/dashboards-notifications/public/pages/Emails/__tests__/EmailSenders.test.tsx b/dashboards-notifications/public/pages/Emails/__tests__/EmailSenders.test.tsx
index b4f01b59..4155065b 100644
--- a/dashboards-notifications/public/pages/Emails/__tests__/EmailSenders.test.tsx
+++ b/dashboards-notifications/public/pages/Emails/__tests__/EmailSenders.test.tsx
@@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
-import { render } from '@testing-library/react';
+import { render, screen } from '@testing-library/react';
import React from 'react';
import { routerComponentPropsMock } from '../../../../test/mocks/routerPropsMock';
import {
@@ -17,16 +17,56 @@ import { MainContext } from '../../Main/Main';
import { EmailSenders } from '../EmailSenders';
describe(' spec', () => {
- it('renders the component', () => {
+ it('renders the component with SMTP config type', () => {
+ const mainState = { ...mainStateMock,
+ availableConfigTypes: [
+ 'slack',
+ 'chime',
+ 'webhook',
+ 'email',
+ 'sns',
+ 'smtp_account',
+ 'ses_account',
+ 'email_group',
+ ],
+ };
const utils = render(
-
-
-
-
-
-
-
+
+
+
+
+
+
+
);
expect(utils.container.firstChild).toMatchSnapshot();
+ expect(screen.queryByText('SMTP senders')).not.toBeNull();
+ expect(screen.queryByText('SES senders')).not.toBeNull();
+ });
+
+ it('renders the component without SMTP config type', async () => {
+ const mainState = { ...mainStateMock,
+ availableConfigTypes: [
+ 'slack',
+ 'chime',
+ 'webhook',
+ 'email',
+ 'sns',
+ 'ses_account',
+ 'email_group',
+ ],
+ };
+ const utils = render(
+
+
+
+
+
+
+
+ );
+ expect(utils.container.firstChild).toMatchSnapshot();
+ expect(screen.queryByText('SMTP senders')).toBeNull();
+ expect(screen.queryByText('SES senders')).not.toBeNull();
});
});
diff --git a/dashboards-notifications/public/pages/Emails/__tests__/__snapshots__/EmailSenders.test.tsx.snap b/dashboards-notifications/public/pages/Emails/__tests__/__snapshots__/EmailSenders.test.tsx.snap
index 90fbd51e..1483fdaa 100644
--- a/dashboards-notifications/public/pages/Emails/__tests__/__snapshots__/EmailSenders.test.tsx.snap
+++ b/dashboards-notifications/public/pages/Emails/__tests__/__snapshots__/EmailSenders.test.tsx.snap
@@ -1,6 +1,14 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
-exports[` spec renders the component 1`] = `
+exports[` spec renders the component with SMTP config type 1`] = `
+
+ Email senders
+
+`;
+
+exports[` spec renders the component without SMTP config type 1`] = `