mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[Security Solution] expandable flyout small cleanup (#155515)
This commit is contained in:
parent
8039fec178
commit
9b6c6bcd9c
6 changed files with 25 additions and 73 deletions
|
@ -54,7 +54,7 @@ describe('<HighlightedFields />', () => {
|
|||
browserFields: {},
|
||||
} as unknown as RightPanelContext;
|
||||
|
||||
const { baseElement } = render(
|
||||
const { container } = render(
|
||||
<ExpandableFlyoutContext.Provider value={flyoutContextValue}>
|
||||
<RightPanelContext.Provider value={panelContextValue}>
|
||||
<HighlightedFields />
|
||||
|
@ -62,11 +62,7 @@ describe('<HighlightedFields />', () => {
|
|||
</ExpandableFlyoutContext.Provider>
|
||||
);
|
||||
|
||||
expect(baseElement).toMatchInlineSnapshot(`
|
||||
<body>
|
||||
<div />
|
||||
</body>
|
||||
`);
|
||||
expect(container).toBeEmptyDOMElement();
|
||||
});
|
||||
|
||||
it('should render empty component if browserFields is null', () => {
|
||||
|
@ -78,7 +74,7 @@ describe('<HighlightedFields />', () => {
|
|||
browserFields: null,
|
||||
} as unknown as RightPanelContext;
|
||||
|
||||
const { baseElement } = render(
|
||||
const { container } = render(
|
||||
<ExpandableFlyoutContext.Provider value={flyoutContextValue}>
|
||||
<RightPanelContext.Provider value={panelContextValue}>
|
||||
<HighlightedFields />
|
||||
|
@ -86,11 +82,7 @@ describe('<HighlightedFields />', () => {
|
|||
</ExpandableFlyoutContext.Provider>
|
||||
);
|
||||
|
||||
expect(baseElement).toMatchInlineSnapshot(`
|
||||
<body>
|
||||
<div />
|
||||
</body>
|
||||
`);
|
||||
expect(container).toBeEmptyDOMElement();
|
||||
});
|
||||
|
||||
it('should render empty component if eventId is null', () => {
|
||||
|
@ -102,7 +94,7 @@ describe('<HighlightedFields />', () => {
|
|||
browserFields: {},
|
||||
} as unknown as RightPanelContext;
|
||||
|
||||
const { baseElement } = render(
|
||||
const { container } = render(
|
||||
<ExpandableFlyoutContext.Provider value={flyoutContextValue}>
|
||||
<RightPanelContext.Provider value={panelContextValue}>
|
||||
<HighlightedFields />
|
||||
|
@ -110,10 +102,6 @@ describe('<HighlightedFields />', () => {
|
|||
</ExpandableFlyoutContext.Provider>
|
||||
);
|
||||
|
||||
expect(baseElement).toMatchInlineSnapshot(`
|
||||
<body>
|
||||
<div />
|
||||
</body>
|
||||
`);
|
||||
expect(container).toBeEmptyDOMElement();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -33,7 +33,7 @@ export const HighlightedFields: FC = () => {
|
|||
}, [eventId, indexName, openRightPanel, scopeId]);
|
||||
|
||||
if (!dataFormattedForFieldBrowser || !browserFields || !eventId) {
|
||||
return <></>;
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
|
@ -33,16 +33,12 @@ describe('<MitreAttack />', () => {
|
|||
},
|
||||
} as unknown as RightPanelContext;
|
||||
|
||||
const { baseElement } = render(
|
||||
const { container } = render(
|
||||
<RightPanelContext.Provider value={contextValue}>
|
||||
<MitreAttack />
|
||||
</RightPanelContext.Provider>
|
||||
);
|
||||
|
||||
expect(baseElement).toMatchInlineSnapshot(`
|
||||
<body>
|
||||
<div />
|
||||
</body>
|
||||
`);
|
||||
expect(container).toBeEmptyDOMElement();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -37,17 +37,13 @@ describe('<Reason />', () => {
|
|||
dataAsNestedObject: {},
|
||||
} as unknown as RightPanelContext;
|
||||
|
||||
const { baseElement } = render(
|
||||
const { container } = render(
|
||||
<RightPanelContext.Provider value={panelContextValue}>
|
||||
<Reason />
|
||||
</RightPanelContext.Provider>
|
||||
);
|
||||
|
||||
expect(baseElement).toMatchInlineSnapshot(`
|
||||
<body>
|
||||
<div />
|
||||
</body>
|
||||
`);
|
||||
expect(container).toBeEmptyDOMElement();
|
||||
});
|
||||
|
||||
it('should render null if dataAsNestedObject is null', () => {
|
||||
|
@ -55,17 +51,13 @@ describe('<Reason />', () => {
|
|||
dataFormattedForFieldBrowser: [],
|
||||
} as unknown as RightPanelContext;
|
||||
|
||||
const { baseElement } = render(
|
||||
const { container } = render(
|
||||
<RightPanelContext.Provider value={panelContextValue}>
|
||||
<Reason />
|
||||
</RightPanelContext.Provider>
|
||||
);
|
||||
|
||||
expect(baseElement).toMatchInlineSnapshot(`
|
||||
<body>
|
||||
<div />
|
||||
</body>
|
||||
`);
|
||||
expect(container).toBeEmptyDOMElement();
|
||||
});
|
||||
it('should render null if renderer is null', () => {
|
||||
const panelContextValue = {
|
||||
|
@ -73,16 +65,12 @@ describe('<Reason />', () => {
|
|||
dataFormattedForFieldBrowser: [],
|
||||
} as unknown as RightPanelContext;
|
||||
|
||||
const { baseElement } = render(
|
||||
const { container } = render(
|
||||
<RightPanelContext.Provider value={panelContextValue}>
|
||||
<Reason />
|
||||
</RightPanelContext.Provider>
|
||||
);
|
||||
|
||||
expect(baseElement).toMatchInlineSnapshot(`
|
||||
<body>
|
||||
<div />
|
||||
</body>
|
||||
`);
|
||||
expect(container).toBeEmptyDOMElement();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -38,17 +38,13 @@ describe('<RiskScore />', () => {
|
|||
getFieldsData: jest.fn(),
|
||||
} as unknown as RightPanelContext;
|
||||
|
||||
const { baseElement } = render(
|
||||
const { container } = render(
|
||||
<RightPanelContext.Provider value={contextValue}>
|
||||
<RiskScore />
|
||||
</RightPanelContext.Provider>
|
||||
);
|
||||
|
||||
expect(baseElement).toMatchInlineSnapshot(`
|
||||
<body>
|
||||
<div />
|
||||
</body>
|
||||
`);
|
||||
expect(container).toBeEmptyDOMElement();
|
||||
});
|
||||
|
||||
it('should render empty component if getFieldsData is invalid', () => {
|
||||
|
@ -56,16 +52,12 @@ describe('<RiskScore />', () => {
|
|||
getFieldsData: jest.fn().mockImplementation(() => 123),
|
||||
} as unknown as RightPanelContext;
|
||||
|
||||
const { baseElement } = render(
|
||||
const { container } = render(
|
||||
<RightPanelContext.Provider value={contextValue}>
|
||||
<RiskScore />
|
||||
</RightPanelContext.Provider>
|
||||
);
|
||||
|
||||
expect(baseElement).toMatchInlineSnapshot(`
|
||||
<body>
|
||||
<div />
|
||||
</body>
|
||||
`);
|
||||
expect(container).toBeEmptyDOMElement();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -38,17 +38,13 @@ describe('<DocumentSeverity />', () => {
|
|||
getFieldsData: jest.fn(),
|
||||
} as unknown as RightPanelContext;
|
||||
|
||||
const { baseElement } = render(
|
||||
const { container } = render(
|
||||
<RightPanelContext.Provider value={contextValue}>
|
||||
<DocumentSeverity />
|
||||
</RightPanelContext.Provider>
|
||||
);
|
||||
|
||||
expect(baseElement).toMatchInlineSnapshot(`
|
||||
<body>
|
||||
<div />
|
||||
</body>
|
||||
`);
|
||||
expect(container).toBeEmptyDOMElement();
|
||||
});
|
||||
|
||||
it('should render empty component if getFieldsData is invalid array', () => {
|
||||
|
@ -56,17 +52,13 @@ describe('<DocumentSeverity />', () => {
|
|||
getFieldsData: jest.fn().mockImplementation(() => ['abc']),
|
||||
} as unknown as RightPanelContext;
|
||||
|
||||
const { baseElement } = render(
|
||||
const { container } = render(
|
||||
<RightPanelContext.Provider value={contextValue}>
|
||||
<DocumentSeverity />
|
||||
</RightPanelContext.Provider>
|
||||
);
|
||||
|
||||
expect(baseElement).toMatchInlineSnapshot(`
|
||||
<body>
|
||||
<div />
|
||||
</body>
|
||||
`);
|
||||
expect(container).toBeEmptyDOMElement();
|
||||
});
|
||||
|
||||
it('should render empty component if getFieldsData is invalid string', () => {
|
||||
|
@ -74,16 +66,12 @@ describe('<DocumentSeverity />', () => {
|
|||
getFieldsData: jest.fn().mockImplementation(() => 'abc'),
|
||||
} as unknown as RightPanelContext;
|
||||
|
||||
const { baseElement } = render(
|
||||
const { container } = render(
|
||||
<RightPanelContext.Provider value={contextValue}>
|
||||
<DocumentSeverity />
|
||||
</RightPanelContext.Provider>
|
||||
);
|
||||
|
||||
expect(baseElement).toMatchInlineSnapshot(`
|
||||
<body>
|
||||
<div />
|
||||
</body>
|
||||
`);
|
||||
expect(container).toBeEmptyDOMElement();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue