diff --git a/public/app/plugins/datasource/cloudwatch/__mocks__/CloudWatchDataSource.ts b/public/app/plugins/datasource/cloudwatch/__mocks__/CloudWatchDataSource.ts index 3a56ca371d5..8ad1ce877db 100644 --- a/public/app/plugins/datasource/cloudwatch/__mocks__/CloudWatchDataSource.ts +++ b/public/app/plugins/datasource/cloudwatch/__mocks__/CloudWatchDataSource.ts @@ -10,8 +10,8 @@ import { } from '@grafana/data'; import { getBackendSrv, setBackendSrv, DataSourceWithBackend } from '@grafana/runtime'; import { TemplateSrv } from 'app/features/templating/template_srv'; -import { initialCustomVariableModelState } from 'app/features/variables/custom/reducer'; +import { initialCustomVariableModelState } from '../__mocks__/variables'; import { CloudWatchDatasource } from '../datasource'; import { CloudWatchJsonData } from '../types'; diff --git a/public/app/plugins/datasource/cloudwatch/__mocks__/ResourcesAPI.ts b/public/app/plugins/datasource/cloudwatch/__mocks__/ResourcesAPI.ts index 8194b6be7be..920cea52cf7 100644 --- a/public/app/plugins/datasource/cloudwatch/__mocks__/ResourcesAPI.ts +++ b/public/app/plugins/datasource/cloudwatch/__mocks__/ResourcesAPI.ts @@ -1,6 +1,6 @@ +import { CustomVariableModel } from '@grafana/data'; import { getBackendSrv, setBackendSrv } from '@grafana/runtime'; import { TemplateSrv } from 'app/features/templating/template_srv'; -import { CustomVariableModel } from 'app/features/variables/types'; import { ResourcesAPI } from '../resources/ResourcesAPI'; diff --git a/public/app/plugins/datasource/cloudwatch/__mocks__/variables.ts b/public/app/plugins/datasource/cloudwatch/__mocks__/variables.ts new file mode 100644 index 00000000000..9f5fb30bba2 --- /dev/null +++ b/public/app/plugins/datasource/cloudwatch/__mocks__/variables.ts @@ -0,0 +1,26 @@ +import { BaseVariableModel, CustomVariableModel, LoadingState, VariableHide, VariableOption } from '@grafana/data'; + +export const initialVariableModelState: BaseVariableModel = { + id: '00000000-0000-0000-0000-000000000000', + rootStateKey: null, + name: '', + type: 'query', + global: false, + index: -1, + hide: VariableHide.dontHide, + skipUrlSync: false, + state: LoadingState.NotStarted, + error: null, + description: null, +}; + +export const initialCustomVariableModelState: CustomVariableModel = { + ...initialVariableModelState, + type: 'custom', + multi: false, + includeAll: false, + allValue: null, + query: '', + options: [], + current: {} as VariableOption, +}; diff --git a/public/app/plugins/datasource/cloudwatch/components/QueryEditor/MetricsQueryEditor/MetricsQueryEditor.test.tsx b/public/app/plugins/datasource/cloudwatch/components/QueryEditor/MetricsQueryEditor/MetricsQueryEditor.test.tsx index 7c212c7ea40..d5519dbbc2f 100644 --- a/public/app/plugins/datasource/cloudwatch/components/QueryEditor/MetricsQueryEditor/MetricsQueryEditor.test.tsx +++ b/public/app/plugins/datasource/cloudwatch/components/QueryEditor/MetricsQueryEditor/MetricsQueryEditor.test.tsx @@ -2,11 +2,11 @@ import { render, screen } from '@testing-library/react'; import React from 'react'; import selectEvent from 'react-select-event'; -import { DataSourceInstanceSettings } from '@grafana/data'; +import { CustomVariableModel, DataSourceInstanceSettings } from '@grafana/data'; import * as ui from '@grafana/ui'; import { TemplateSrv } from 'app/features/templating/template_srv'; -import { CustomVariableModel, initialVariableModelState } from '../../../../../../features/variables/types'; +import { initialVariableModelState } from '../../../__mocks__/variables'; import { CloudWatchDatasource } from '../../../datasource'; import { CloudWatchJsonData, MetricEditorMode, MetricQueryType } from '../../../types'; diff --git a/public/app/plugins/datasource/cloudwatch/query-runner/CloudWatchMetricsQueryRunner.test.ts b/public/app/plugins/datasource/cloudwatch/query-runner/CloudWatchMetricsQueryRunner.test.ts index fa0790b10f6..3b73fa18fdd 100644 --- a/public/app/plugins/datasource/cloudwatch/query-runner/CloudWatchMetricsQueryRunner.test.ts +++ b/public/app/plugins/datasource/cloudwatch/query-runner/CloudWatchMetricsQueryRunner.test.ts @@ -3,7 +3,6 @@ import { of } from 'rxjs'; import { CustomVariableModel, getFrameDisplayName, VariableHide } from '@grafana/data'; import { dateTime } from '@grafana/data/src/datetime/moment_wrapper'; import { BackendDataSourceResponse } from '@grafana/runtime'; -import { initialVariableModelState } from 'app/features/variables/types'; import * as redux from 'app/store/store'; import { @@ -17,6 +16,7 @@ import { } from '../__mocks__/CloudWatchDataSource'; import { setupMockedMetricsQueryRunner } from '../__mocks__/MetricsQueryRunner'; import { validMetricSearchBuilderQuery, validMetricSearchCodeQuery } from '../__mocks__/queries'; +import { initialVariableModelState } from '../__mocks__/variables'; import { MetricQueryType, MetricEditorMode, CloudWatchMetricsQuery, DataQueryError } from '../types'; describe('CloudWatchMetricsQueryRunner', () => {