-
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
[Enterprise Search] Kea mount test helper #87247
Conversation
@scottybollinger FYI - you may find this helper useful in your Workplace Search logic tests as well. You can use it in logic file tests to pass default values without having to manually set them. It also handles |
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.
This is awesome! Can't wait to use it. Thanks Constance!
const path = this.logicFile.inputs[0].path as string[]; | ||
const defaults = path.reduceRight((value: object, key: string) => ({ [key]: value }), values); |
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.
Example path:
['enterprise_search', 'app_search', 'engine_overview_logic']
Example defaults:
{
defaults: {
enterprise_search: {
app_search: {
engine_overview_logic: {
...values
}
}
}
}
}
I've never actually seen/used .reduceRight
before this but was super surprised at how easy it was to find a one-liner that did exactly what we wanted 🤯
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.
I love me some reduce 👍
eb322d9
to
4c57493
Compare
💚 Build SucceededMetrics [docs]Distributable file count
History
To update your PR or re-run it, just comment with: |
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.
Thanks for doing this Constance!
* Add Kea logic mount helper * Update existing mount() helpers to use new DRY helper * Add additional unmount helper + example test update Co-authored-by: Kibana Machine <[email protected]>
Summary
After discussing this in a previous PR (#86822 (review)), I went ahead and created a test helper that DRY's out our repeated
mount
helpers across several tests. Super huge thanks to Jason for giving an example API!Usage:
Checklist