kibana/packages/kbn-securitysolution-exception-list-components
Ryland Herrick 4efcc28d78
[Chore] Remove third-party testing internals from test snapshots (#192747)
## Summary

This removes some indavertent testing of third-party
APIs/implementations caused by directly passing the result of a
`render()` call to `toMatchSnapshot()`.

In all cases, this was solved by passing `render().container` (the root
element rendered by the testing library) instead.

These changes remove implementation details of both styled-components
(#192368 being the reason for this commit) and testing-library from the
snapshots.


### Checklist


- [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
2024-09-13 17:47:12 -05:00
..
src [Chore] Remove third-party testing internals from test snapshots (#192747) 2024-09-13 17:47:12 -05:00
index.ts Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
jest.config.js Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
kibana.jsonc [Security Solution] Clean up CODEOWNERS and other files for the Detection Engine team (#159729) 2023-06-14 10:39:50 -07:00
package.json Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
README.md [Security Solution][Exceptions] - Create/ refactor Exception-List common's components in @kbn/securitysolution-exception-list-components (#143363) 2022-10-19 19:33:17 +02:00
setup_test.ts Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
tsconfig.json [Security Solution][Artifacts][Trusted Apps] Wildcard warning with IS operator for trusted apps creation/editing (#175356) 2024-02-13 21:43:25 -07:00

@kbn/securitysolution-exception-list-components

Common exceptions' components

Aim

  • To have most of the Exceptions' components in one place, to be shared accross multiple pages and used for different logic.
  • This package holds the presetational part of the components only as the API or the logic part should reside under the consumer page

Pattern used

component
    index.tsx
    index.styles.ts <-- to hold styles if the component has many custom styles
    use_component.ts <-- for logic if the Presentational Component has logic
    component.test.tsx
    use_component.test.tsx
  

Testing

In order to unify our testing tools, we configured only two libraries, the React-Testing-Library to test the component UI part and the Reat-Testing-Hooks to test the component's UI interactions

Styling

In order to follow the KBN-Packages's recommendations, to define a custom CSS we can only use the @emotion/react or @emotion/css libraries

Next

  • Now the ExceptionItems, ExceptionItemCard and ExceptionItemCardMetaInfo receive securityLinkAnchorComponent, exceptionsUtilityComponent , and exceptionsUtilityComponent as props to avoid moving all the common components under the x-pack at once, later we should move all building blocks to this kbn-package