mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
## 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 Co-authored-by: Frank Hassanabad <frank.hassanabad@elastic.co>
This commit is contained in:
parent
59ce3c0cd0
commit
81608279ea
3 changed files with 2 additions and 18 deletions
|
@ -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']);
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -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];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue