/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/
import { render, waitFor } from '@testing-library/react';
import { configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import React from 'react';
import { MOCK_DATA } from '../../../../test/mocks/mockData';
import {
coreServicesMock,
mainStateMock,
} from '../../../../test/mocks/serviceMock';
import { CoreServicesContext } from '../../../components/coreServices';
import { ServicesContext } from '../../../services';
import { MainContext } from '../../Main/Main';
import { EmailSettings } from '../components/EmailSettings';
import { CreateChannelContext } from '../CreateChannel';
describe(' spec', () => {
configure({ adapter: new Adapter() });
it('renders the component', async () => {
const notificationServiceMock = jest.fn() as any;
const getSenders = jest.fn(
async (queryObject: object) => MOCK_DATA.senders
);
const getRecipientGroups = jest.fn(
async (queryObject: object) => MOCK_DATA.recipientGroups
);
notificationServiceMock.notificationService = {
getSenders,
getRecipientGroups,
};
const setSelectedSenderOptions = jest.fn();
const setSelectedRecipientGroupOptions = jest.fn();
const setInputErrors = jest.fn();
const setSenderType = jest.fn();
const utils = render(
);
utils.getByText('Create SMTP sender').click();
utils.getByText('Create recipient group').click();
await waitFor(() => {
expect(getSenders).toBeCalled();
expect(getRecipientGroups).toBeCalled();
});
});
});