2017-10-22 00:03:26 -05:00
|
|
|
import { configure } from 'enzyme';
|
|
|
|
import Adapter from 'enzyme-adapter-react-16';
|
2018-06-12 09:14:22 -05:00
|
|
|
import 'jquery';
|
|
|
|
import $ from 'jquery';
|
|
|
|
import 'angular';
|
|
|
|
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-03 04:30:44 -05:00
|
|
|
const global = window as any;
|
2018-06-12 09:14:22 -05:00
|
|
|
global.$ = global.jQuery = $;
|
2018-09-02 12:36:36 -05:00
|
|
|
|
2018-09-07 10:55:38 -05:00
|
|
|
const localStorageMock = (() => {
|
|
|
|
let store = {};
|
2018-09-02 12:36:36 -05:00
|
|
|
return {
|
2018-09-07 10:55:38 -05:00
|
|
|
getItem: key => {
|
2018-09-02 12:36:36 -05:00
|
|
|
return store[key];
|
|
|
|
},
|
2018-09-07 10:55:38 -05:00
|
|
|
setItem: (key, value) => {
|
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 = {};
|
|
|
|
},
|
2018-09-07 10:55:38 -05:00
|
|
|
removeItem: key => {
|
2018-09-02 12:36:36 -05:00
|
|
|
delete store[key];
|
|
|
|
},
|
|
|
|
};
|
|
|
|
})();
|
|
|
|
|
|
|
|
global.localStorage = localStorageMock;
|
|
|
|
// Object.defineProperty(window, 'localStorage', { value: localStorageMock });
|