2017-10-22 00:03:26 -05:00
|
|
|
import { configure } from 'enzyme';
|
2020-11-18 12:37:17 -06:00
|
|
|
import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
|
2018-06-12 09:14:22 -05:00
|
|
|
import $ from 'jquery';
|
2020-02-17 04:13:13 -06:00
|
|
|
import 'mutationobserver-shim';
|
2019-11-07 05:37:46 -06:00
|
|
|
|
|
|
|
const global = window as any;
|
|
|
|
global.$ = global.jQuery = $;
|
|
|
|
|
|
|
|
import '../vendor/flot/jquery.flot';
|
|
|
|
import '../vendor/flot/jquery.flot.time';
|
2018-06-12 09:14:22 -05:00
|
|
|
import angular from 'angular';
|
|
|
|
|
|
|
|
angular.module('grafana', ['ngRoute']);
|
|
|
|
angular.module('grafana.services', ['ngRoute', '$strap.directives']);
|
|
|
|
angular.module('grafana.panels', []);
|
|
|
|
angular.module('grafana.controllers', []);
|
|
|
|
angular.module('grafana.directives', []);
|
|
|
|
angular.module('grafana.filters', []);
|
|
|
|
angular.module('grafana.routes', ['ngRoute']);
|
|
|
|
|
|
|
|
jest.mock('app/core/core', () => ({}));
|
|
|
|
jest.mock('app/features/plugins/plugin_loader', () => ({}));
|
2017-10-22 00:03:26 -05:00
|
|
|
|
|
|
|
configure({ adapter: new Adapter() });
|
2018-06-12 09:14:22 -05:00
|
|
|
|
2018-09-07 10:55:38 -05:00
|
|
|
const localStorageMock = (() => {
|
2019-06-19 12:59:03 -05:00
|
|
|
let store: any = {};
|
2018-09-02 12:36:36 -05:00
|
|
|
return {
|
2019-04-03 04:41:08 -05:00
|
|
|
getItem: (key: string) => {
|
2018-09-02 12:36:36 -05:00
|
|
|
return store[key];
|
|
|
|
},
|
2019-06-19 12:59:03 -05:00
|
|
|
setItem: (key: string, value: any) => {
|
2018-09-02 12:36:36 -05:00
|
|
|
store[key] = value.toString();
|
|
|
|
},
|
2018-09-07 10:55:38 -05:00
|
|
|
clear: () => {
|
2018-09-02 12:36:36 -05:00
|
|
|
store = {};
|
|
|
|
},
|
2019-04-03 04:41:08 -05:00
|
|
|
removeItem: (key: string) => {
|
2018-09-02 12:36:36 -05:00
|
|
|
delete store[key];
|
|
|
|
},
|
|
|
|
};
|
|
|
|
})();
|
|
|
|
|
|
|
|
global.localStorage = localStorageMock;
|
2019-10-04 05:01:42 -05:00
|
|
|
|
2019-09-25 07:10:11 -05:00
|
|
|
const throwUnhandledRejections = () => {
|
2021-01-20 00:59:48 -06:00
|
|
|
process.on('unhandledRejection', (err) => {
|
2019-09-25 07:10:11 -05:00
|
|
|
throw err;
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
throwUnhandledRejections();
|