Skip to content

Commit

Permalink
Update UT
Browse files Browse the repository at this point in the history
Signed-off-by: Yibo Wang <yibow@amazon.com>
  • Loading branch information
yibow98 committed Oct 10, 2022
1 parent 64c6307 commit ccf9e03
Show file tree
Hide file tree
Showing 2 changed files with 134 additions and 21 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,26 @@
*/

import React from 'react';
import { shallow } from 'enzyme';
import { mount } from 'enzyme';
import { ExperimentalCallout } from './experimental_callout';
import { DocLinksStart } from 'opensearch-dashboards/public';
import { docLinks } from '../../../mocks';

describe('Dataasource experimental callout component', () => {
const titleIdentifier = '.euiCallOutHeader__title';
const descriptionIdentifier = '[data-test-subj="data-source-experimental-call"]';
const expectedTitleText = 'Experimental Feature';
const expectedDescriptionText =
'Experimental FeatureThe feature is experimental and should not be used in a production environment. Any index patterns, visualization, and observability panels will be impacted if the feature is deactivated. For more information see Data Source Documentation(opens in a new tab or window) To leave feedback, visit OpenSearch Forum';

describe('Datasource experimental callout component', () => {
test('should render normally', () => {
const mockedDocLinks = docLinks as DocLinksStart;
const component = shallow(<ExperimentalCallout docLinks={mockedDocLinks} />);
const component = mount(<ExperimentalCallout docLinks={mockedDocLinks} />);
const titleText = component.find(titleIdentifier).text();
const descriptionText = component.find(descriptionIdentifier).last().text();

expect(titleText).toBe(expectedTitleText);
expect(descriptionText).toBe(expectedDescriptionText);
expect(component).toMatchSnapshot();
});
});

0 comments on commit ccf9e03

Please sign in to comment.