-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Security Solution][Test] Enzyme test for related events button #74411
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
import { EndpointEvent } from '../../../../common/endpoint/types'; | ||
|
||
/** | ||
* Simple mock related event. | ||
*/ | ||
export function mockRelatedEvent({ | ||
entityID, | ||
timestamp, | ||
category, | ||
type, | ||
id, | ||
}: { | ||
entityID: string; | ||
timestamp: number; | ||
category: string; | ||
type: string; | ||
id?: string; | ||
}): EndpointEvent { | ||
return { | ||
'@timestamp': timestamp, | ||
event: { | ||
kind: 'event', | ||
type, | ||
category, | ||
id: id ?? 'xyz', | ||
}, | ||
process: { | ||
entity_id: entityID, | ||
}, | ||
} as EndpointEvent; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -220,6 +220,28 @@ export class Simulator { | |
); | ||
} | ||
|
||
/** | ||
* Dump all contents of the outer ReactWrapper (to be `console.log`ged as appropriate) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❔ add comment about mixing React & DOM There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
* This will include both DOM (div, span, etc.) and React/JSX (MyComponent, MyGrid, etc.) | ||
*/ | ||
public debugWrapper() { | ||
return this.wrapper.debug(); | ||
} | ||
|
||
/** | ||
* Return an Enzyme ReactWrapper that includes the Related Events host button for a given process node | ||
* | ||
* @param entityID The entity ID of the proocess node to select in | ||
*/ | ||
public processNodeRelatedEventButton(entityID: string): ReactWrapper { | ||
return this.processNodeElements({ entityID }).findWhere( | ||
(wrapper) => | ||
// Filter out React components | ||
typeof wrapper.type() === 'string' && | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you add a comment here saying something like 'filter out React components'? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
wrapper.prop('data-test-subj') === 'resolver:submenu:button' | ||
); | ||
} | ||
|
||
/** | ||
* Return the selected node query string values. | ||
*/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❔ add id
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a48a10a#diff-d991ae971eb0dc808e612349a2c70b9aR30