Closed yuliacech closed 1 month ago
should it be in Kibana or an import from EUI
I think this is worth suggesting to the EUI team. It'd be a great opportunity to start aligning EUI consumers on some testing best practices.
After a discussion with ES UI team, we would like to add a folder test
to es_ui_shared
plugin to keep EUI component mocks used in ES UI plugin tests. New tests will then import existing mocks, so no need to always copy paste mocks for every plugin.
Closing as not planned, will revisit as needed when working on tests
While working on PR#97472 we started a discussion on how to handle mocking EUI components like
EuiCombobox
orEuiSearchBox
in our jest client integration tests. We need to mock some EUI components to have an easy way of interacting with them in tests. There are helper functions available inpackages/kbn-test/src/jest/utils/testbed/testbed.ts
(i.e.setComboboxValue
) and mocks for EUI components in individual tests (x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/global_mocks.tsx
). A quick search through Kibana code base shows that mocks are used and repeated in tests in several plugins.I'd like to start a discussion if we need a central place for mocks:
htmlIdGenerator
,EuiComboBox
,EuiCodeEditor
what else?)cc @elastic/es-ui