From 22d932a3907bca6364de4a081624941330316e55 Mon Sep 17 00:00:00 2001 From: parkiino Date: Mon, 10 Jun 2024 11:25:49 -0400 Subject: [PATCH] fix function and variable names --- .../src/path_validations/index.test.ts | 8 ++++---- .../src/path_validations/index.ts | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/kbn-securitysolution-utils/src/path_validations/index.test.ts b/packages/kbn-securitysolution-utils/src/path_validations/index.test.ts index ebd7f967f7860..f768b78b932f4 100644 --- a/packages/kbn-securitysolution-utils/src/path_validations/index.test.ts +++ b/packages/kbn-securitysolution-utils/src/path_validations/index.test.ts @@ -11,7 +11,7 @@ import { hasSimpleExecutableName, OperatingSystem, ConditionEntryField, - doesAnyValueContainWildcard, + validateWildcardInput, validateHasWildcardWithWrongOperator, validatePotentialWildcardInput, validateFilePathInput, @@ -40,12 +40,12 @@ describe('validatePotentialWildcardInput', () => { }); }); -describe('doesAnyValueContainWildcard', () => { +describe('validateWildcardInput', () => { it('warns on wildcard for fields that are not file paths', () => { - expect(doesAnyValueContainWildcard('*')).toEqual(WILDCARD_WARNING); + expect(validateWildcardInput('*')).toEqual(WILDCARD_WARNING); }); it('does not warn if no wildcard', () => { - expect(doesAnyValueContainWildcard('non-wildcard')).toEqual(undefined); + expect(validateWildcardInput('non-wildcard')).toEqual(undefined); }); }); diff --git a/packages/kbn-securitysolution-utils/src/path_validations/index.ts b/packages/kbn-securitysolution-utils/src/path_validations/index.ts index 4187458264959..2c5505f90d74a 100644 --- a/packages/kbn-securitysolution-utils/src/path_validations/index.ts +++ b/packages/kbn-securitysolution-utils/src/path_validations/index.ts @@ -66,7 +66,7 @@ export const validatePotentialWildcardInput = ({ if (field === 'file.path.text') { return validateFilePathInput({ os, value: textInput }); } - return doesAnyValueContainWildcard(textInput); + return validateWildcardInput(textInput); }; export const validateFilePathInput = ({ @@ -101,11 +101,11 @@ export const validateFilePathInput = ({ } }; -export const doesAnyValueContainWildcard = (value: string | string[]): string | undefined => { +export const validateWildcardInput = (value: string | string[]): string | undefined => { const wildcardRegex = /[*?]/; if (Array.isArray(value)) { - const test = value.some((v) => wildcardRegex.test(v)); - if (test) { + const doesAnyValueContainWildcardInput = value.some((v) => wildcardRegex.test(v)); + if (doesAnyValueContainWildcardInput) { return WILDCARD_WARNING; } } else { @@ -122,7 +122,7 @@ export const validateHasWildcardWithWrongOperator = ({ operator: TrustedAppEntryTypes | EventFiltersTypes; value: string | string[]; }): boolean => { - if (operator !== 'wildcard' && doesAnyValueContainWildcard(value)) { + if (operator !== 'wildcard' && validateWildcardInput(value)) { return true; } else { return false;