-
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
[Snapshot & Restore] Remove axios
dependency in tests
#128614
[Snapshot & Restore] Remove axios
dependency in tests
#128614
Conversation
initialEntries: ['/add_policy'], | ||
componentRoutePath: '/add_policy', | ||
}, | ||
doMountAsync: true, |
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 was previously mounting the component on the wrong route, but since we had a wildcard api mock with sinon things were working anyway.
@@ -805,8 +812,12 @@ describe('<SnapshotRestoreHome />', () => { | |||
|
|||
test('should display a message when snapshot in progress ', async () => { | |||
const { find, actions } = testBed; | |||
const updatedSnapshot = { ...snapshot1, state: 'IN_PROGRESS' }; | |||
httpRequestsMockHelpers.setGetSnapshotResponse(updatedSnapshot); | |||
const updatedSnapshot = { ...snapshot2, state: 'IN_PROGRESS' }; |
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.
Was previously using the wrong snapshot mock but since the api call had a wildcard it was working fine.
Pinging @elastic/platform-deployment-management (Team:Deployment Management) |
@elasticmachine merge upstream |
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.
Great work @sabarasaba! LGTM.
export const WithAppDependencies = (Comp: any) => (props: any) => | ||
( | ||
export const WithAppDependencies = (Comp: any, httpSetup?: HttpSetup) => (props: any) => { | ||
// We need to optionally setup the httpService since some cit helpers (such as snapshot_list.helpers) |
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 adding this comment!
@elasticmachine merge upstream |
💚 Build SucceededMetrics [docs]
History
To update your PR or re-run it, just comment with: cc @sabarasaba |
* wip: start refactoring test helpers * commit using @elastic.co * Fix more tests * Finish off refactoring all cits * Add docs * Fix linter issues * Fix ts issues (cherry picked from commit fa74030) # Conflicts: # x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/home.helpers.ts # x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/policy_add.helpers.ts # x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/policy_edit.helpers.ts # x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/repository_add.helpers.ts # x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/repository_edit.helpers.ts # x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/restore_snapshot.helpers.ts
…29343) * wip: start refactoring test helpers * commit using @elastic.co * Fix more tests * Finish off refactoring all cits * Add docs * Fix linter issues * Fix ts issues (cherry picked from commit fa74030) # Conflicts: # x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/home.helpers.ts # x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/policy_add.helpers.ts # x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/policy_edit.helpers.ts # x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/repository_add.helpers.ts # x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/repository_edit.helpers.ts # x-pack/plugins/snapshot_restore/__jest__/client_integration/helpers/restore_snapshot.helpers.ts
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.