@@ -42,20 +42,7 @@ describe('connector_add_flyout', () => {
4242 } ) ;
4343
4444 it ( 'renders action type menu on flyout open' , ( ) => {
45- const actionType = {
46- id : 'my-action-type' ,
47- iconClass : 'test' ,
48- selectMessage : 'test' ,
49- validateConnector : ( ) : ValidationResult => {
50- return { errors : { } } ;
51- } ,
52- validateParams : ( ) : ValidationResult => {
53- const validationResult = { errors : { } } ;
54- return validationResult ;
55- } ,
56- actionConnectorFields : null ,
57- actionParamsFields : null ,
58- } ;
45+ const actionType = createActionType ( ) ;
5946 actionTypeRegistry . get . mockReturnValueOnce ( actionType ) ;
6047 actionTypeRegistry . has . mockReturnValue ( true ) ;
6148
@@ -88,6 +75,83 @@ describe('connector_add_flyout', () => {
8875 </ ActionsConnectorsContextProvider >
8976 ) ;
9077 expect ( wrapper . find ( 'ActionTypeMenu' ) ) . toHaveLength ( 1 ) ;
91- expect ( wrapper . find ( '[data-test-subj="my-action-type-card"]' ) . exists ( ) ) . toBeTruthy ( ) ;
78+ expect ( wrapper . find ( `[data-test-subj="${ actionType . id } -card"]` ) . exists ( ) ) . toBeTruthy ( ) ;
79+ } ) ;
80+
81+ it ( 'renders banner with subscription links when features are disbaled due to licensing ' , ( ) => {
82+ const actionType = createActionType ( ) ;
83+ const disabledActionType = createActionType ( ) ;
84+
85+ actionTypeRegistry . get . mockReturnValueOnce ( actionType ) ;
86+ actionTypeRegistry . has . mockReturnValue ( true ) ;
87+
88+ const wrapper = mountWithIntl (
89+ < ActionsConnectorsContextProvider
90+ value = { {
91+ http : deps ! . http ,
92+ toastNotifications : deps ! . toastNotifications ,
93+ actionTypeRegistry : deps ! . actionTypeRegistry ,
94+ capabilities : deps ! . capabilities ,
95+ reloadConnectors : ( ) => {
96+ return new Promise < void > ( ( ) => { } ) ;
97+ } ,
98+ } }
99+ >
100+ < ConnectorAddFlyout
101+ addFlyoutVisible = { true }
102+ setAddFlyoutVisibility = { ( ) => { } }
103+ actionTypes = { [
104+ {
105+ id : actionType . id ,
106+ enabled : true ,
107+ name : 'Test' ,
108+ enabledInConfig : true ,
109+ enabledInLicense : true ,
110+ minimumLicenseRequired : 'basic' ,
111+ } ,
112+ {
113+ id : disabledActionType . id ,
114+ enabled : true ,
115+ name : 'Test' ,
116+ enabledInConfig : true ,
117+ enabledInLicense : false ,
118+ minimumLicenseRequired : 'gold' ,
119+ } ,
120+ ] }
121+ />
122+ </ ActionsConnectorsContextProvider >
123+ ) ;
124+ const callout = wrapper . find ( 'UpgradeYourLicenseCallOut' ) ;
125+ expect ( callout ) . toHaveLength ( 1 ) ;
126+
127+ const subscriptionLinks = callout . find ( 'EuiButton' ) ;
128+ expect ( subscriptionLinks ) . toHaveLength ( 2 ) ;
129+
130+ const [ linkToSubscribePage , linkToManageLicense ] = subscriptionLinks . getElements ( ) ;
131+
132+ expect ( linkToSubscribePage . props . href ) . toMatchInlineSnapshot (
133+ `"https://www.elastic.co/subscriptions"`
134+ ) ;
135+ expect ( linkToManageLicense . props . href ) . toMatchInlineSnapshot (
136+ `"/app/kibana#/management/elasticsearch/license_management/"`
137+ ) ;
92138 } ) ;
93139} ) ;
140+
141+ let count = 0 ;
142+ function createActionType ( ) {
143+ return {
144+ id : `my-action-type-${ ++ count } ` ,
145+ iconClass : 'test' ,
146+ selectMessage : 'test' ,
147+ validateConnector : ( ) : ValidationResult => {
148+ return { errors : { } } ;
149+ } ,
150+ validateParams : ( ) : ValidationResult => {
151+ const validationResult = { errors : { } } ;
152+ return validationResult ;
153+ } ,
154+ actionConnectorFields : null ,
155+ actionParamsFields : null ,
156+ } ;
157+ }
0 commit comments