Skip to content

Commit e15b87c

Browse files
committed
fix mocking
1 parent 2d7e1ea commit e15b87c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/metric_find_query.test.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import 'whatwg-fetch'; // fetch polyfill needed backendSrv
22
import { DataSourceInstanceSettings, TimeRange, toUtc } from '@grafana/data';
3-
import { FetchResponse } from '@grafana/runtime';
4-
import { backendSrv } from 'app/core/services/backend_srv'; // will use the version in __mocks__
5-
import { TemplateSrv } from 'app/features/templating/template_srv';
3+
import { FetchResponse, getBackendSrv, TemplateSrv } from '@grafana/runtime';
64
import { of } from 'rxjs';
75

86
import { PrometheusDatasource } from './datasource';
97
import PrometheusMetricFindQuery from './metric_find_query';
108
import { PromApplication, PromOptions } from './types';
119

10+
// This should be mocked like here https://github.com/grafana/grafana/blob/main/public/app/plugins/datasource/influxdb/mocks.ts
11+
const backendSrv = getBackendSrv();
12+
1213
jest.mock('@grafana/runtime', () => ({
1314
...jest.requireActual('@grafana/runtime'),
1415
getBackendSrv: () => backendSrv,

0 commit comments

Comments
 (0)