You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

29 lines
1.1 KiB

import { AnalyticController } from '../src/panel/graph_panel/controllers/analytic_controller';
import { AnalyticUnit, AnalyticUnitId } from '../src/panel/graph_panel/models/analytic_unit';
import { AnalyticService } from '../src/panel/graph_panel/services/analytic_service';
import { MetricExpanded } from '../src/panel/graph_panel/models/metric';
import { DatasourceRequest } from '../src/panel/graph_panel/models/datasource';
import { Emitter } from 'grafana/app/core/utils/emitter';
// prevent "Symbol.asyncIterator is not defined" error
(<any>Symbol).asyncIterator = Symbol.asyncIterator || Symbol.for("Symbol.asyncIterator");
var id = 0;
function $http() {
return { data: { pattern: [], thresholds: [] } };
}
const analyticService = new AnalyticService('', $http);
analyticService.postNewItem = async function (newItem: AnalyticUnit, metric: MetricExpanded, datasource: DatasourceRequest, panelUrl: string
): Promise<AnalyticUnitId> {
id++;
return Promise.resolve(id.toString());
}
export const analyticController = new AnalyticController({}, analyticService, new Emitter());
console.log = jest.fn();
console.error = jest.fn();