Removes isUuid and tests as they're not used anymore (#116848)

## Summary

Removes isUuid and tests as they're not used anymore

### Checklist

Delete any items that are not applicable to this PR.
- [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
This commit is contained in:
Frank Hassanabad 2021-10-29 19:33:59 -06:00 committed by GitHub
parent 2797fab000
commit 57899a2f68
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 18 deletions

View file

@ -6,7 +6,7 @@
*/
import { validateSingleAction, validateRuleActionsField } from './schema';
import { isUuid, getActionTypeName, validateMustache, validateActionParams } from './utils';
import { getActionTypeName, validateMustache, validateActionParams } from './utils';
import { actionTypeRegistryMock } from '../../../../../../triggers_actions_ui/public/application/action_type_registry.mock';
import { FormHook } from '../../../../shared_imports';
jest.mock('./utils');
@ -86,9 +86,7 @@ describe('stepRuleActions schema', () => {
});
it('should validate multiple incorrect rule actions field', async () => {
(isUuid as jest.Mock).mockReturnValueOnce(false);
(getActionTypeName as jest.Mock).mockReturnValueOnce('Slack');
(isUuid as jest.Mock).mockReturnValueOnce(true);
(getActionTypeName as jest.Mock).mockReturnValueOnce('Pagerduty');
(validateActionParams as jest.Mock).mockReturnValue(['Summary is required']);
(validateMustache as jest.Mock).mockReturnValue(['Component is not valid mustache template']);

View file

@ -6,19 +6,9 @@
*/
import { actionTypeRegistryMock } from '../../../../../../triggers_actions_ui/public/application/action_type_registry.mock';
import { isUuid, getActionTypeName, validateMustache, validateActionParams } from './utils';
import { getActionTypeName, validateMustache, validateActionParams } from './utils';
describe('stepRuleActions utils', () => {
describe('isUuidv4', () => {
it('should validate proper uuid v4 value', () => {
expect(isUuid('817b8bca-91d1-4729-8ee1-3a83aaafd9d4')).toEqual(true);
});
it('should validate incorrect uuid v4 value', () => {
expect(isUuid('ad9d4')).toEqual(false);
});
});
describe('getActionTypeName', () => {
it('should return capitalized action type name', () => {
expect(getActionTypeName('.slack')).toEqual('Slack');

View file

@ -14,10 +14,6 @@ import {
} from '../../../../../../triggers_actions_ui/public';
import * as I18n from './translations';
const UUID_REGEX = /^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i;
export const isUuid = (id: AlertAction['id']) => !!id.match(UUID_REGEX);
export const getActionTypeName = (actionTypeId: AlertAction['actionTypeId']) => {
if (!actionTypeId) return '';
const actionType = actionTypeId.split('.')[1];