[File upload] Switch to index pattern service shim (#49893)

* Switch to index pattern service shim

* Fix test breaking due to unrelated import in same file

* Move mock and require out of before call to top of file since they're not directly test-related

* Some minor cleanup

* One more thing...
This commit is contained in:
Aaron Caldwell 2019-11-01 07:47:13 -06:00 committed by GitHub
parent dbc9a52fd8
commit cf03665b98
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 6 deletions

View file

@ -4,10 +4,6 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { uiModules } from 'ui/modules';
import { start as data } from '../../../../../src/legacy/core_plugins/data/public/legacy';
export let indexPatternService;
uiModules.get('app/file_upload').run(($injector) => {
indexPatternService = $injector.get('indexPatterns');
});
export const indexPatternService = data.indexPatterns.indexPatterns;

View file

@ -4,6 +4,9 @@
* you may not use this file except in compliance with the Elastic License.
*/
// Not all index pattern dependencies are avab. in jest context,
// prevent unrelated import errors by mocking kibana services
jest.mock('../kibana_services', () => {});
import { checkIndexPatternValid } from './indexing_service';
describe('indexing_service', () => {