[7.x] [Enterprise Search] Mocks/tests tech debt - avoid hungry mocking (#101107)#101788
Merged
cee-chen merged 1 commit intoelastic:7.xfrom Jun 9, 2021
Merged
[7.x] [Enterprise Search] Mocks/tests tech debt - avoid hungry mocking (#101107)#101788cee-chen merged 1 commit intoelastic:7.xfrom
cee-chen merged 1 commit intoelastic:7.xfrom
Conversation
…stic#101107) * Move enzyme & misc test helpers out of __mocks__/ and into new test_helpers/ They're not technically mocks since nothing is being mocked, so we should move them into a test_helpers folder for specificity & organization * Move React Router mocks into its own separate folder/import This was part of the initial feedback, that it was unclear why importing something for Kea in __mocks__/index.ts was mocking react router along for the ride. Separating this out makes things clearer and imports more explicit + add some handy new mock useX jest.fn()s helpers, so we're not doing `useParams() as jest.Mock` errywhere * Move Kea & logic mocks/helpers into kea_logic subfolder - for organization NOTE: It can't be a plain kea/ folder because then Jest automatically mocks the `kea` module itself kea 🤦 * Fix type failures - Caused by switch from any to unknown (changed back to any + added a .test_helper suffix exclusion for any) * Fix Enterprise Search tests/imports - I checked all application folders but this one, whoops * PR feedback: comment copy * Update tests/files added since PR open with new import locations * Fix misc react router typing - null not being type-able as a boolean - forgot to remove various useParam imports after adding mockUseParams + misc unused kea import, probably added while debugging kea mocks # Conflicts: # x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_overview.test.tsx # x-pack/plugins/enterprise_search/public/applications/app_search/components/crawler/crawler_overview_logic.test.ts
Contributor
💚 Build SucceededMetrics [docs]
To update your PR or re-run it, just comment with: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backports the following commits to 7.x: