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 19272cc commit b9ed285
Show file tree
Hide file tree
Showing 4 changed files with 88 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] Add experimental callout for index pattern section ([#2523](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2523))

### 🐛 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,12 +4,23 @@
*/

import React from 'react';
import { shallow } from 'enzyme';
import { mount } from 'enzyme';
import { ExperimentalCallout } from './experimental_callout';

const titleIdentifier = '.euiCallOutHeader__title';
const descriptionIdentifier = '[data-test-subj="index-pattern-experimental-callout-text"]';
const expectedTitleText = 'Experimental feature active';
const expectedDescriptionText =
'The experimental feature Data Source Connection is active. To create an index pattern without using data from an external source, use default. Any index pattern created using an external data source will result in an error if the experimental feature is deactivated.';

describe('Index pattern experimental callout component', () => {
test('should render normally', () => {
const component = shallow(<ExperimentalCallout />);
const component = mount(<ExperimentalCallout />);
const titleText = component.find(titleIdentifier).text();
const descriptionText = component.find(descriptionIdentifier).last().text();

expect(titleText).toBe(expectedTitleText);
expect(descriptionText).toBe(expectedDescriptionText);
expect(component).toMatchSnapshot();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ export const ExperimentalCallout = () => {
color="warning"
data-test-subj="index-pattern-experimental-callout"
>
<p>
<EuiText data-test-subj="index-pattern-experimental-callout-text">
<EuiText data-test-subj="index-pattern-experimental-callout-text">
<p>
{DESCRIPTION_FIRST_PART}
<b>{DATASOURCE_CONNECTION}</b>
{DESCRIPTION_SECOND_PART}
<b>{DEFAULT}</b>
{DESCRIPTION_THIRD_PART}
</EuiText>
</p>
</p>
</EuiText>
</EuiCallOut>
<EuiSpacer size="m" />
</>
Expand Down

0 comments on commit b9ed285

Please sign in to comment.