Skip to content

Conversation

@rylnd
Copy link
Contributor

@rylnd rylnd commented Aug 24, 2020

Backports the following commits to 7.x:

* Simplify our kibana mocks

* Simpler mock factory that returns an object instead of a thunk
  * We can use mockReturnValue instead of mockImplementation to
  accomplish the same
  * Allows us to replace createStartServices mock
* Uses unknown instead of any for mocks

* Clean up our manual use of kibana mocks in tests

* Since our useKibana mock returns a consistent mock, we can modify its
return value instead of re-mocking the entire thing
* Removes unnecessary uses of clearing/resetting mocks
  * If your mocks are configured at the beginning of each test this is
  usually unnecessary.
  * I left one case of clearAllMocks in all_cases/index.test since it
  defined several mock functions that were persistent across tests, and
  it was easier than moving their definitions to a beforeEach
* Removes some unnecessary overrides that seemed due to storage
previously not being mocked

* Rename some old occurrences of SIEM

* Cross-reference similar hooks via JSDoc

There's a good chance that the consumer might want the OTHER hook, so
let's make that discoverable.

* Adds jest tests for our useListsConfig hook

* adds mocks for the hooks upon which it depends

* Add a mock for our useListsConfig hook

Leverages this mock factory in our manual mock for this hook.

* Remove unneeded eslint exception

* Move kibana_react mocks into their own .mock file

We're trying to consolidate mocks to this pattern so that they're easier
to find and reuse.

* Remove intermediate mock factory

This was only being consumed by our general createStartServicesMock.

* Replace security_solution's alias for a core mock

This is just noise/tech debt, we should use the core mock directly when
we can.

* Remove unnecessary wrapper around core mocks

Instead let's just reference the core mocks themselves.

* Remove outdated references from upstream

* More accurate mock

Throw an error of the same type if an unexpected key is used.

Co-authored-by: Elastic Machine <[email protected]>
@rylnd rylnd added the backport This PR is a backport of another PR label Aug 24, 2020
@rylnd
Copy link
Contributor Author

rylnd commented Aug 24, 2020

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Build metrics

async chunks size

id value diff baseline
securitySolution 7.2MB +36.0B 7.2MB

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@rylnd rylnd merged commit d7efaf0 into elastic:7.x Aug 25, 2020
@rylnd rylnd deleted the backport/7.x/pr-74920 branch August 25, 2020 01:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR is a backport of another PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants