Skip to content

Commit

Permalink
Update UT
Browse files Browse the repository at this point in the history
Signed-off-by: Yibo Wang <[email protected]>
  • Loading branch information
yibow98 committed Oct 10, 2022
1 parent 64c6307 commit 56d4bf8
Show file tree
Hide file tree
Showing 3 changed files with 134 additions and 22 deletions.
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
* [Viz Builder] Create a new wizard directly on a dashboard ([#2384](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2384))
* [Multi DataSource] UX enhacement on index pattern management stack ([#2505](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2505))
* [Multi DataSource] UX enhancement on Data source management stack ([#2521](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2521))
* [Multi DataSource] UX enhancement for Data source management creation page ([#2051](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2501))

### 🐛 Bug Fixes

Expand Down

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 56d4bf8

Please sign in to comment.