-
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
Add ClusterClient, KibanaRequest, SessionFactory and Lifecycle toolkit mocks #40352
Conversation
Pinging @elastic/kibana-platform |
💚 Build Succeeded |
💚 Build Succeeded |
9b1baf4
to
2eb5d09
Compare
headers = { accept: 'something/html' }, | ||
params = {}, | ||
body = {}, | ||
query, |
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.
query, params and body are passed already parsed in KibanaRequest
and not to overcomplicate setup I added them as plain objects
💔 Build Failed |
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.
Looks good, just a couple minor changes.
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.
Tested on #39446 and looks good, thanks! Even though we still have issues with mocking of ES6 classes here and there, it's already a huge step forward and simplifies tests a lot.
💔 Build Failed |
💚 Build Succeeded |
…t mocks (elastic#40352) * add mocks - expose Elatissearch mocks, KibanaRequest mock - Logging service mock should accept LoggerFactory - Provide mocks for session storage - add return for registerAuth mock - add mocks for http lifecycle toolkits * remove leftovers * address @eli comments
Summary
Close #40186
Added mocks for
I noticed 2 problems:
x-pack
loose type safely for mocks that usePublicMethodsOf
helper. because this helper is defined here https://github.com/restrry/kibana/blob/8616ea8a101f8a1f34d4e629f13075ef03a4f617/typings/index.d.ts#L30 and not included inx-pack
typings. I think the proper solution is to move this helper to 「DISCUSS」TypeScript utility types #39881 and use one type in all places.The same old problem that we cannot declare mock for a class #33396