-
Notifications
You must be signed in to change notification settings - Fork 912
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Multiple Datasource Test] Add test for error_menu, item, data_source…
…_multi_selectable (#6752) (#6768) * add test for data_source_error_menu, data_source_item, data_source_multi_selectable * Changeset file for PR #6752 created/updated * add content verify in test --------- (cherry picked from commit d920951) Signed-off-by: yujin-emma <yujin.emma.work@gmail.com> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com> Co-authored-by: ZilongX <99905560+ZilongX@users.noreply.github.com>
- Loading branch information
1 parent
331c436
commit ee31ca8
Showing
5 changed files
with
185 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
fix: | ||
- Add test for data_source_error_menu, data_source_item, data_source_multi_selectable ([#6752](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/6752)) |
95 changes: 95 additions & 0 deletions
95
...blic/components/data_source_error_menu/__snapshots__/data_source_error_menu.test.tsx.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
28 changes: 28 additions & 0 deletions
28
...ource_management/public/components/data_source_error_menu/data_source_error_menu.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
import { DataSourceErrorMenu } from './data_source_error_menu'; | ||
import { coreMock } from '../../../../../core/public/mocks'; | ||
import { render } from '@testing-library/react'; | ||
|
||
describe('DataSourceErrorMenu', () => { | ||
const applicationMock = coreMock.createStart().application; | ||
it('renders without crashing', () => { | ||
const component = shallow(<DataSourceErrorMenu application={applicationMock} />); | ||
expect(component).toMatchSnapshot(); | ||
}); | ||
|
||
it('should toggle popover when icon button is clicked', () => { | ||
const container = render(<DataSourceErrorMenu application={applicationMock} />); | ||
const iconButton = container.getByTestId('dataSourceErrorMenuHeaderLink'); | ||
iconButton.click(); | ||
expect(container.getByTestId('dataSourceErrorPopover')).toBeVisible(); | ||
expect(container.getByTestId('datasourceTableEmptyState')).toHaveTextContent( | ||
'Failed to fetch data sources' | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters