2017-10-22 07:03:26 +02:00
|
|
|
import { configure } from 'enzyme';
|
2020-11-18 19:37:17 +01:00
|
|
|
import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
|
2018-06-12 16:14:22 +02:00
|
|
|
import $ from 'jquery';
|
2020-02-17 11:13:13 +01:00
|
|
|
import 'mutationobserver-shim';
|
2019-11-07 12:37:46 +01:00
|
|
|
|
|
|
|
|
const global = window as any;
|
|
|
|
|
global.$ = global.jQuery = $;
|
|
|
|
|
|
|
|
|
|
import '../vendor/flot/jquery.flot';
|
|
|
|
|
import '../vendor/flot/jquery.flot.time';
|
2018-06-12 16:14:22 +02: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 07:03:26 +02:00
|
|
|
|
|
|
|
|
configure({ adapter: new Adapter() });
|
2018-06-12 16:14:22 +02:00
|
|
|
|
2018-09-07 17:55:38 +02:00
|
|
|
const localStorageMock = (() => {
|
2019-06-19 19:59:03 +02:00
|
|
|
let store: any = {};
|
2018-09-02 10:36:36 -07:00
|
|
|
return {
|
2019-04-03 11:41:08 +02:00
|
|
|
getItem: (key: string) => {
|
2018-09-02 10:36:36 -07:00
|
|
|
return store[key];
|
|
|
|
|
},
|
2019-06-19 19:59:03 +02:00
|
|
|
setItem: (key: string, value: any) => {
|
2018-09-02 10:36:36 -07:00
|
|
|
store[key] = value.toString();
|
|
|
|
|
},
|
2018-09-07 17:55:38 +02:00
|
|
|
clear: () => {
|
2018-09-02 10:36:36 -07:00
|
|
|
store = {};
|
|
|
|
|
},
|
2019-04-03 11:41:08 +02:00
|
|
|
removeItem: (key: string) => {
|
2018-09-02 10:36:36 -07:00
|
|
|
delete store[key];
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
})();
|
|
|
|
|
|
|
|
|
|
global.localStorage = localStorageMock;
|
2019-10-04 12:01:42 +02:00
|
|
|
|
2019-09-25 05:10:11 -07:00
|
|
|
const throwUnhandledRejections = () => {
|
2021-01-20 07:59:48 +01:00
|
|
|
process.on('unhandledRejection', (err) => {
|
2019-09-25 05:10:11 -07:00
|
|
|
throw err;
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
throwUnhandledRejections();
|