diff --git a/x-pack/plugins/cases/public/components/utils.test.ts b/x-pack/plugins/cases/public/components/utils.test.ts index 496dc8d8c806..86d37d2e5e59 100644 --- a/x-pack/plugins/cases/public/components/utils.test.ts +++ b/x-pack/plugins/cases/public/components/utils.test.ts @@ -7,7 +7,7 @@ import { actionTypeRegistryMock } from '../../../triggers_actions_ui/public/application/action_type_registry.mock'; import { triggersActionsUiMock } from '../../../triggers_actions_ui/public/mocks'; -import { getConnectorIcon } from './utils'; +import { getConnectorIcon, isDeprecatedConnector } from './utils'; describe('Utils', () => { describe('getConnectorIcon', () => { @@ -37,4 +37,10 @@ describe('Utils', () => { expect(getConnectorIcon(mockTriggersActionsUiService, '.not-registered')).toBe(''); }); }); + + describe('isDeprecatedConnector', () => { + it('returns false if the connector is not defined', () => { + expect(isDeprecatedConnector()).toBe(false); + }); + }); }); diff --git a/x-pack/plugins/cases/public/components/utils.ts b/x-pack/plugins/cases/public/components/utils.ts index 74137789958a..3ac48135edae 100644 --- a/x-pack/plugins/cases/public/components/utils.ts +++ b/x-pack/plugins/cases/public/components/utils.ts @@ -80,7 +80,7 @@ export const getConnectorIcon = ( // TODO: Remove when the applications are certified export const isDeprecatedConnector = (connector?: CaseActionConnector): boolean => { if (connector == null) { - return true; + return false; } if (!ENABLE_NEW_SN_ITSM_CONNECTOR && connector.actionTypeId === '.servicenow') { diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/helpers.test.ts b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/helpers.test.ts index e40db85bcb12..525430ea7fc6 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/helpers.test.ts +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/helpers.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { isRESTApiError, isFieldInvalid } from './helpers'; +import { isRESTApiError, isFieldInvalid, isDeprecatedConnector } from './helpers'; describe('helpers', () => { describe('isRESTApiError', () => { @@ -48,4 +48,10 @@ describe('helpers', () => { expect(isFieldInvalid('description', [])).toBeFalsy(); }); }); + + describe('isDeprecatedConnector', () => { + it('returns false if the connector is not defined', () => { + expect(isDeprecatedConnector()).toBe(false); + }); + }); }); diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/helpers.ts b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/helpers.ts index 755923acc25c..7274c5952741 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/helpers.ts +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/servicenow/helpers.ts @@ -28,9 +28,9 @@ export const isFieldInvalid = ( ): boolean => error !== undefined && error.length > 0 && field != null; // TODO: Remove when the applications are certified -export const isDeprecatedConnector = (connector: ServiceNowActionConnector): boolean => { +export const isDeprecatedConnector = (connector?: ServiceNowActionConnector): boolean => { if (connector == null) { - return true; + return false; } if (!ENABLE_NEW_SN_ITSM_CONNECTOR && connector.actionTypeId === '.servicenow') {