From ccf9e03be8e0cb6cfd1b16009998682faf6ea90f Mon Sep 17 00:00:00 2001 From: Yibo Wang Date: Mon, 10 Oct 2022 11:28:49 -0700 Subject: [PATCH] Update UT Signed-off-by: Yibo Wang --- .../experimental_callout.test.tsx.snap | 138 +++++++++++++++--- .../experimental_callout.test.tsx | 17 ++- 2 files changed, 134 insertions(+), 21 deletions(-) diff --git a/src/plugins/data_source_management/public/management_app/compoenent/experimental_callout/__snapshots__/experimental_callout.test.tsx.snap b/src/plugins/data_source_management/public/management_app/compoenent/experimental_callout/__snapshots__/experimental_callout.test.tsx.snap index e1b90e038970..f3c2e06db210 100644 --- a/src/plugins/data_source_management/public/management_app/compoenent/experimental_callout/__snapshots__/experimental_callout.test.tsx.snap +++ b/src/plugins/data_source_management/public/management_app/compoenent/experimental_callout/__snapshots__/experimental_callout.test.tsx.snap @@ -1,31 +1,133 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Dataasource experimental callout component should render normally 1`] = ` - +exports[`Datasource experimental callout component should render normally 1`] = ` + -

- The 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 - - - To leave feedback, visit -
+ - OpenSearch Forum - -

+
+ +
+

+ The 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 + + + +

+
+
+
+
+
-
+ > +
+ + `; diff --git a/src/plugins/data_source_management/public/management_app/compoenent/experimental_callout/experimental_callout.test.tsx b/src/plugins/data_source_management/public/management_app/compoenent/experimental_callout/experimental_callout.test.tsx index 42f7453d8a41..cd61e0ea2056 100644 --- a/src/plugins/data_source_management/public/management_app/compoenent/experimental_callout/experimental_callout.test.tsx +++ b/src/plugins/data_source_management/public/management_app/compoenent/experimental_callout/experimental_callout.test.tsx @@ -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(); + const component = mount(); + const titleText = component.find(titleIdentifier).text(); + const descriptionText = component.find(descriptionIdentifier).last().text(); + + expect(titleText).toBe(expectedTitleText); + expect(descriptionText).toBe(expectedDescriptionText); expect(component).toMatchSnapshot(); }); });