-
Notifications
You must be signed in to change notification settings - Fork 917
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Signed-off-by: Yuanqi(Ella) Zhu <[email protected]> (cherry picked from commit 87deeda) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> # Conflicts: # CHANGELOG.md Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
9ac936c
commit 620b5e6
Showing
9 changed files
with
220 additions
and
41 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
50 changes: 47 additions & 3 deletions
50
...ponents/data_source_multi_selectable/__snapshots__/data_source_filter_group.test.tsx.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 2 additions & 0 deletions
2
...nts/data_source_multi_selectable/__snapshots__/data_source_multi_selectable.test.tsx.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
46 changes: 46 additions & 0 deletions
46
src/plugins/data_source_management/public/components/data_source_option.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,46 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { shallow } from 'enzyme'; | ||
import React from 'react'; | ||
import { EuiBadge, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; | ||
import { DataSourceOptionItem } from './data_source_option'; | ||
import { SelectedDataSourceOption } from './data_source_multi_selectable/data_source_filter_group'; | ||
|
||
describe('Test on ShowDataSourceOption', () => { | ||
it('should render the component with label', () => { | ||
const item: SelectedDataSourceOption = { | ||
id: '1', | ||
label: 'DataSource 1', | ||
visible: true, | ||
}; | ||
const defaultDataSource = null; | ||
|
||
const component = shallow( | ||
<DataSourceOptionItem item={item} defaultDataSource={defaultDataSource} /> | ||
); | ||
|
||
expect(component.find(EuiFlexGroup)).toHaveLength(1); | ||
expect(component.find(EuiFlexItem)).toHaveLength(1); | ||
expect(component.find(EuiBadge)).toHaveLength(0); | ||
}); | ||
|
||
it('should render the component with label and default badge', () => { | ||
const item = { | ||
id: '1', | ||
label: 'DataSource 1', | ||
visible: true, | ||
}; | ||
const defaultDataSource = '1'; | ||
|
||
const component = shallow( | ||
<DataSourceOptionItem item={item} defaultDataSource={defaultDataSource} /> | ||
); | ||
|
||
expect(component.find(EuiFlexGroup)).toHaveLength(1); | ||
expect(component.find(EuiFlexItem)).toHaveLength(2); | ||
expect(component.find(EuiBadge)).toHaveLength(1); | ||
}); | ||
}); |
Oops, something went wrong.