-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* [Watcher] Remove `axios` dependency in tests (#128765) * wip start refactoring tests * commit using @elastic.co * Finish refactoring tests * Remove unused code * Add docs * Address CR changes (cherry picked from commit 1caaaba) # Conflicts: # x-pack/plugins/watcher/__jest__/client_integration/helpers/index.ts # x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_create_json.helpers.ts # x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_create_threshold.helpers.ts # x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_edit.helpers.ts # x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_list.helpers.ts # x-pack/plugins/watcher/__jest__/client_integration/helpers/watch_status.helpers.ts # x-pack/plugins/watcher/__jest__/client_integration/watch_create_threshold.test.tsx # x-pack/plugins/watcher/__jest__/client_integration/watch_edit.test.ts * Fix test and linter Co-authored-by: Kibana Machine <[email protected]>
- Loading branch information
1 parent
1a56bb2
commit 1010bd6
Showing
18 changed files
with
465 additions
and
523 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 0 additions & 10 deletions
10
x-pack/plugins/watcher/__jest__/client_integration/helpers/body_response.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 0 additions & 42 deletions
42
x-pack/plugins/watcher/__jest__/client_integration/helpers/setup_environment.ts
This file was deleted.
Oops, something went wrong.
39 changes: 39 additions & 0 deletions
39
x-pack/plugins/watcher/__jest__/client_integration/helpers/setup_environment.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { HttpSetup } from 'src/core/public'; | ||
|
||
import { init as initHttpRequests } from './http_requests'; | ||
import { mockContextValue } from './app_context.mock'; | ||
import { AppContextProvider } from '../../../public/application/app_context'; | ||
import { setHttpClient, setSavedObjectsClient } from '../../../public/application/lib/api'; | ||
|
||
const mockSavedObjectsClient = () => { | ||
return { | ||
find: (_params?: any) => ({ | ||
savedObjects: [], | ||
}), | ||
}; | ||
}; | ||
|
||
export const WithAppDependencies = | ||
(Component: any, httpSetup: HttpSetup) => (props: Record<string, unknown>) => { | ||
setHttpClient(httpSetup); | ||
|
||
return ( | ||
<AppContextProvider value={mockContextValue}> | ||
<Component {...props} /> | ||
</AppContextProvider> | ||
); | ||
}; | ||
|
||
export const setupEnvironment = () => { | ||
setSavedObjectsClient(mockSavedObjectsClient() as any); | ||
|
||
return initHttpRequests(); | ||
}; |
Oops, something went wrong.