Skip to content

Commit

Permalink
apply rewview comment
Browse files Browse the repository at this point in the history
  • Loading branch information
WafaaNasr committed Oct 19, 2022
1 parent e348f33 commit f015511
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import * as i18n from '../translations';
import type { Rule } from '../../types';
import { MetaInfoDetails } from './details_info';
import { HeaderMenu } from '../../header_menu';
import { generateLinedRulesMenuItems } from '../../generate_linked_rules_menu_item';
import { generateLinkedRulesMenuItems } from '../../generate_linked_rules_menu_item';

const itemCss = css`
border-right: 1px solid #d3dae6;
Expand All @@ -37,7 +37,7 @@ export const ExceptionItemCardMetaInfo = memo<ExceptionItemCardMetaInfoProps>(

const referencedLinks = useMemo(
() =>
generateLinedRulesMenuItems({
generateLinkedRulesMenuItems({
dataTestSubj,
linkedRules: rules,
securityLinkAnchorComponent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { render } from '@testing-library/react';
import { ReactElement } from 'react';
import { ElementType } from 'react';
import { generateLinedRulesMenuItems } from '.';
import { generateLinkedRulesMenuItems } from '.';
import { rules } from '../mocks/rule_references.mock';
import {
getSecurityLinkAction,
Expand All @@ -20,23 +20,23 @@ const linkedRules = rules;

describe('generateLinedRulesMenuItems', () => {
it('should not render if the linkedRules length is falsy', () => {
const result = generateLinedRulesMenuItems({
const result = generateLinkedRulesMenuItems({
dataTestSubj,
linkedRules: [],
securityLinkAnchorComponent: securityLinkAnchorComponentMock,
});
expect(result).toBeNull();
});
it('should not render if the securityLinkAnchorComponent length is falsy', () => {
const result = generateLinedRulesMenuItems({
const result = generateLinkedRulesMenuItems({
dataTestSubj,
linkedRules,
securityLinkAnchorComponent: null as unknown as ElementType,
});
expect(result).toBeNull();
});
it('should render the first linked rules with left icon and does not apply the css if the length is 1', () => {
const result: ReactElement[] = generateLinedRulesMenuItems({
const result: ReactElement[] = generateLinkedRulesMenuItems({
dataTestSubj,
linkedRules,
securityLinkAnchorComponent: securityLinkAnchorComponentMock,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ interface MenuItemLinkedRulesProps {
securityLinkAnchorComponent: ElementType; // This property needs to be removed to avoid the Prop Drilling, once we move all the common components from x-pack/security-solution/common
}

export const generateLinedRulesMenuItems = ({
export const generateLinkedRulesMenuItems = ({
dataTestSubj,
linkedRules,
securityLinkAnchorComponent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { HeaderMenu } from '../../header_menu';
import { headerMenuCss } from '../list_header.styles';
import * as i18n from '../../translations';
import { Rule } from '../../types';
import { generateLinedRulesMenuItems } from '../../generate_linked_rules_menu_item';
import { generateLinkedRulesMenuItems } from '../../generate_linked_rules_menu_item';
interface MenuItemsProps {
isReadonly: boolean;
dataTestSubj?: string;
Expand All @@ -33,7 +33,7 @@ const MenuItemsComponent: FC<MenuItemsProps> = ({
}) => {
const referencedLinks = useMemo(
() =>
generateLinedRulesMenuItems({
generateLinkedRulesMenuItems({
leftIcon: 'check',
dataTestSubj,
linkedRules,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Side Public License, v 1.
*/
import React, { ReactElement } from 'react';
import { generateLinedRulesMenuItems } from '../generate_linked_rules_menu_item';
import { generateLinkedRulesMenuItems } from '../generate_linked_rules_menu_item';
import { rules } from './rule_references.mock';
export const securityLinkAnchorComponentMock = ({
referenceName,
Expand All @@ -21,7 +21,7 @@ export const securityLinkAnchorComponentMock = ({
);

export const getSecurityLinkAction = (dataTestSubj: string) =>
generateLinedRulesMenuItems({
generateLinkedRulesMenuItems({
dataTestSubj,
linkedRules: [
...rules,
Expand Down

0 comments on commit f015511

Please sign in to comment.