-
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
[Ingest Pipelines] Remove axios
dependency in tests
#128467
Conversation
@elasticmachine merge upstream |
Pinging @elastic/platform-deployment-management (Team:Deployment Management) |
'/api/ingest_pipelines/simulate' | ||
expect(httpSetup.post).toHaveBeenLastCalledWith( | ||
`${API_BASE_PATH}/simulate`, | ||
expect.anything() |
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.
nit: I don't think that would test for 2 different calls to the simulate API. You might want to use toHaveBeenCalledTimes
or toHaveBeenNthCalledWith
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.
nice catch!, ill patch it up!
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 a lot for updating these tests, @sabarasaba! Changes LGTM 👍
There is quite some boilerplate for mock setup but I've seen your discussion about keeping that implementation in each plugin separately for now.
@elasticmachine merge upstream |
💚 Build SucceededMetrics [docs]
History
To update your PR or re-run it, just comment with: cc @sabarasaba |
💔 All backports failed
Manual backportTo create the backport manually run:
Questions ?Please refer to the Backport tool documentation |
* Refactor main cits * commit using @elastic.co * Finish refactoring pipeline_editor cits * Carefully access prop * Fix hardcoded props * Fix ts issues * Add back missing attr * Address CR changes (cherry picked from commit d869a7f) # Conflicts: # x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/http_requests.ts # x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_clone.helpers.ts # x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_create.helpers.ts # x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_create_from_csv.helpers.ts # x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_edit.helpers.ts # x-pack/plugins/ingest_pipelines/__jest__/client_integration/ingest_pipelines_create_from_csv.test.tsx
) * Refactor main cits * commit using @elastic.co * Finish refactoring pipeline_editor cits * Carefully access prop * Fix hardcoded props * Fix ts issues * Add back missing attr * Address CR changes (cherry picked from commit d869a7f) # Conflicts: # x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/http_requests.ts # x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_clone.helpers.ts # x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_create.helpers.ts # x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_create_from_csv.helpers.ts # x-pack/plugins/ingest_pipelines/__jest__/client_integration/helpers/pipelines_edit.helpers.ts # x-pack/plugins/ingest_pipelines/__jest__/client_integration/ingest_pipelines_create_from_csv.test.tsx
Partially addresses #127966
Summary
In order to upgrade the axios dependency in kibana(see: #111655) we need to switch the tests from this app to use HttpSetup mock instead of axios + sinon server mock, which is technically incorrect but axios just happened to have methods signature similar to HttpSetup.
Note: There's a bunch of CIT's for
pipeline_editor
that live inx-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__
, ideally thesetup_environment.ts
andhttp_request.ts
files could be refactored into just one. I'll create an issue for dealing with that