@@ -8,7 +8,7 @@ import userEvent from '@testing-library/user-event';
8
8
import { render , screen , waitFor } from '../../../test/test_utils' ;
9
9
import { DataSourceTopNavMenu , DataSourceTopNavMenuProps } from '../data_source_top_nav_menu' ;
10
10
import { coreMock } from '../../../../../src/core/public/mocks' ;
11
- import { DataSourceContext , DataSourceContextProvider } from '../../contexts' ;
11
+ import { DataSourceContext } from '../../contexts' ;
12
12
13
13
function setup ( options : Partial < DataSourceTopNavMenuProps > = { } ) {
14
14
const user = userEvent . setup ( { } ) ;
@@ -38,15 +38,10 @@ function setup(options: Partial<DataSourceTopNavMenuProps> = {}) {
38
38
) ;
39
39
40
40
const DataSourceConsumer = ( ) => {
41
- const { dataSourceEnabled , selectedDataSourceOption } = useContext ( DataSourceContext ) ;
41
+ const { selectedDataSourceOption } = useContext ( DataSourceContext ) ;
42
42
43
43
return (
44
44
< div >
45
- < input
46
- value = { JSON . stringify ( dataSourceEnabled ) }
47
- aria-label = "dataSourceEnabled"
48
- onChange = { ( ) => { } }
49
- />
50
45
< input
51
46
value = {
52
47
selectedDataSourceOption === undefined
@@ -65,13 +60,6 @@ function setup(options: Partial<DataSourceTopNavMenuProps> = {}) {
65
60
< DataSourceTopNavMenu
66
61
notifications = { coreStart . notifications }
67
62
savedObjects = { coreStart . savedObjects }
68
- dataSource = { {
69
- dataSourceEnabled : true ,
70
- noAuthenticationTypeEnabled : true ,
71
- awsSigV4AuthEnabled : true ,
72
- hideLocalCluster : false ,
73
- usernamePasswordAuthEnabled : true ,
74
- } }
75
63
dataSourceManagement = { {
76
64
registerAuthenticationMethod : jest . fn ( ) ,
77
65
ui : {
@@ -89,42 +77,16 @@ function setup(options: Partial<DataSourceTopNavMenuProps> = {}) {
89
77
}
90
78
91
79
describe ( '<DataSourceTopNavMenu />' , ( ) => {
92
- it ( 'should not render data source menu when data source and data source management not defined' , ( ) => {
93
- setup ( {
94
- dataSource : undefined ,
95
- dataSourceManagement : undefined ,
96
- } ) ;
97
- expect ( screen . queryByText ( 'Data Source Menu' ) ) . not . toBeInTheDocument ( ) ;
98
- } ) ;
99
- it ( 'should not render data source menu when data source not defined' , ( ) => {
100
- setup ( {
101
- dataSource : undefined ,
102
- } ) ;
103
- expect ( screen . queryByText ( 'Data Source Menu' ) ) . not . toBeInTheDocument ( ) ;
104
- } ) ;
105
80
it ( 'should not render data source menu when data source management not defined' , ( ) => {
106
81
setup ( {
107
82
dataSourceManagement : undefined ,
108
83
} ) ;
109
84
expect ( screen . queryByText ( 'Data Source Menu' ) ) . not . toBeInTheDocument ( ) ;
110
85
} ) ;
111
- it ( 'should not render data source menu when data source not enabled' , ( ) => {
112
- setup ( {
113
- dataSource : {
114
- dataSourceEnabled : false ,
115
- noAuthenticationTypeEnabled : false ,
116
- awsSigV4AuthEnabled : false ,
117
- hideLocalCluster : false ,
118
- usernamePasswordAuthEnabled : false ,
119
- } ,
120
- } ) ;
121
- expect ( screen . queryByText ( 'Data Source Menu' ) ) . not . toBeInTheDocument ( ) ;
122
- } ) ;
123
86
124
87
it ( 'should render data source menu and data source context' , ( ) => {
125
88
setup ( ) ;
126
89
expect ( screen . getByText ( 'Data Source Menu' ) ) . toBeInTheDocument ( ) ;
127
- expect ( screen . getByLabelText ( 'dataSourceEnabled' ) ) . toHaveValue ( 'true' ) ;
128
90
expect ( screen . getByLabelText ( 'selectedDataSourceOption' ) ) . toHaveValue ( 'null' ) ;
129
91
} ) ;
130
92
0 commit comments