/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/
import { render } 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,
notificationServiceMock,
} from '../../../../test/mocks/serviceMock';
import { CoreServicesContext } from '../../../components/coreServices';
import { ServicesContext } from '../../../services';
import { ChannelDetailsActions } from '../components/details/ChannelDetailsActions';
describe(' spec', () => {
configure({ adapter: new Adapter() });
it('renders the component', () => {
const channel = MOCK_DATA.chime;
const utils = render(
);
expect(utils.container.firstChild).toMatchSnapshot();
});
it('opens popover', () => {
const channel = MOCK_DATA.chime;
const utils = render(
);
utils.getByText('Actions').click();
expect(utils.container.firstChild).toMatchSnapshot();
});
it('clicks buttons in popover', () => {
const channel = MOCK_DATA.chime;
const utils = render(
);
utils.getByText('Actions').click();
utils.getByText('Edit').click();
utils.getByText('Actions').click();
utils.getByText('Send test message').click();
utils.getByText('Actions').click();
utils.getByText('Delete').click();
expect(utils.container.firstChild).toMatchSnapshot();
});
});