mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Set tsconfig target to ES6 (#44842)
* chore(tsconfig): update grafana/tsconfig to 1.2.0 for outputting es6 * rewrote the unsubscription part to use first(). * test: update failing tests to work with es6 output * removed bug where we dispatch a promise instead of an array of ritch history. Co-authored-by: Marcus Andersson <marcus.andersson@grafana.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { throwError } from 'rxjs';
|
||||
import { delay } from 'rxjs/operators';
|
||||
import { delay, first } from 'rxjs/operators';
|
||||
import { setDataSourceSrv } from '@grafana/runtime';
|
||||
import { AlertState, AlertStateInfo } from '@grafana/data';
|
||||
|
||||
@@ -60,18 +60,19 @@ function expectOnResults(args: {
|
||||
expect: (results: DashboardQueryRunnerResult) => void;
|
||||
}) {
|
||||
const { runner, done, panelId, expect: expectCallback } = args;
|
||||
const subscription = runner.getResult(panelId).subscribe({
|
||||
next: (value) => {
|
||||
try {
|
||||
expectCallback(value);
|
||||
subscription?.unsubscribe();
|
||||
done();
|
||||
} catch (err) {
|
||||
subscription?.unsubscribe();
|
||||
done.fail(err);
|
||||
}
|
||||
},
|
||||
});
|
||||
runner
|
||||
.getResult(panelId)
|
||||
.pipe(first())
|
||||
.subscribe({
|
||||
next: (value) => {
|
||||
try {
|
||||
expectCallback(value);
|
||||
done();
|
||||
} catch (err) {
|
||||
done.fail(err);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
describe('DashboardQueryRunnerImpl', () => {
|
||||
|
||||
@@ -17,7 +17,7 @@ describe('OpenTsQueryCtrl', () => {
|
||||
refresh: () => {},
|
||||
};
|
||||
|
||||
OpenTsQueryCtrl.prototype = Object.assign(OpenTsQueryCtrl.prototype, ctx);
|
||||
Object.assign(OpenTsQueryCtrl.prototype, ctx);
|
||||
|
||||
beforeEach(() => {
|
||||
ctx.ctrl = new OpenTsQueryCtrl({}, {} as any);
|
||||
|
||||
@@ -10,11 +10,9 @@ import { dateTime, EventBusSrv } from '@grafana/data';
|
||||
import { DashboardModel } from '../../../../features/dashboard/state';
|
||||
|
||||
jest.mock('../event_manager', () => ({
|
||||
EventManager: () => {
|
||||
return {
|
||||
on: () => {},
|
||||
addFlotEvents: () => {},
|
||||
};
|
||||
EventManager: class EventManagerMock {
|
||||
on() {}
|
||||
addFlotEvents() {}
|
||||
},
|
||||
}));
|
||||
|
||||
@@ -47,7 +45,7 @@ describe('grafanaGraph', () => {
|
||||
lightTheme: false,
|
||||
},
|
||||
};
|
||||
GraphCtrl.prototype = {
|
||||
Object.assign(GraphCtrl.prototype, {
|
||||
...MetricsPanelCtrl.prototype,
|
||||
...PanelCtrl.prototype,
|
||||
...GraphCtrl.prototype,
|
||||
@@ -96,7 +94,7 @@ describe('grafanaGraph', () => {
|
||||
annotationsSrv: {
|
||||
getAnnotations: () => Promise.resolve({}),
|
||||
},
|
||||
} as any;
|
||||
}) as any;
|
||||
|
||||
ctx.data = [];
|
||||
ctx.data.push(
|
||||
|
||||
Reference in New Issue
Block a user