|
|
|
@ -60,8 +60,7 @@ import { expect } from '../../../../test/lib/common'; |
|
|
|
import { ConstantVariableModel, VariableRefresh } from '../types'; |
|
|
|
import { ConstantVariableModel, VariableRefresh } from '../types'; |
|
|
|
import { updateVariableOptions } from '../query/reducer'; |
|
|
|
import { updateVariableOptions } from '../query/reducer'; |
|
|
|
import { setVariableQueryRunner, VariableQueryRunner } from '../query/VariableQueryRunner'; |
|
|
|
import { setVariableQueryRunner, VariableQueryRunner } from '../query/VariableQueryRunner'; |
|
|
|
import { setDataSourceSrv } from '@grafana/runtime'; |
|
|
|
import { setDataSourceSrv, setLocationService } from '@grafana/runtime'; |
|
|
|
import { LocationState } from 'app/types'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
variableAdapters.setInit(() => [ |
|
|
|
variableAdapters.setInit(() => [ |
|
|
|
createQueryVariableAdapter(), |
|
|
|
createQueryVariableAdapter(), |
|
|
|
@ -146,8 +145,9 @@ describe('shared actions', () => { |
|
|
|
const list = [query, constant, datasource, custom, textbox]; |
|
|
|
const list = [query, constant, datasource, custom, textbox]; |
|
|
|
const preloadedState = { |
|
|
|
const preloadedState = { |
|
|
|
templating: ({} as unknown) as TemplatingState, |
|
|
|
templating: ({} as unknown) as TemplatingState, |
|
|
|
location: ({ query: {} } as unknown) as LocationState, |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
const locationService: any = { getSearchObject: () => ({}) }; |
|
|
|
|
|
|
|
setLocationService(locationService); |
|
|
|
|
|
|
|
|
|
|
|
const tester = await reduxTester<TemplatingReducerType>({ preloadedState }) |
|
|
|
const tester = await reduxTester<TemplatingReducerType>({ preloadedState }) |
|
|
|
.givenRootReducer(getTemplatingRootReducer()) |
|
|
|
.givenRootReducer(getTemplatingRootReducer()) |
|
|
|
@ -203,9 +203,10 @@ describe('shared actions', () => { |
|
|
|
|
|
|
|
|
|
|
|
const list = [stats, substats]; |
|
|
|
const list = [stats, substats]; |
|
|
|
const query = { orgId: '1', 'var-stats': 'response', 'var-substats': ALL_VARIABLE_TEXT }; |
|
|
|
const query = { orgId: '1', 'var-stats': 'response', 'var-substats': ALL_VARIABLE_TEXT }; |
|
|
|
|
|
|
|
const locationService: any = { getSearchObject: () => query }; |
|
|
|
|
|
|
|
setLocationService(locationService); |
|
|
|
const preloadedState = { |
|
|
|
const preloadedState = { |
|
|
|
templating: ({} as unknown) as TemplatingState, |
|
|
|
templating: ({} as unknown) as TemplatingState, |
|
|
|
location: ({ query } as unknown) as LocationState, |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const tester = await reduxTester<TemplatingReducerType>({ preloadedState }) |
|
|
|
const tester = await reduxTester<TemplatingReducerType>({ preloadedState }) |
|
|
|
@ -223,6 +224,9 @@ describe('shared actions', () => { |
|
|
|
toVariablePayload(stats, { option: { text: ALL_VARIABLE_TEXT, value: ALL_VARIABLE_VALUE, selected: false } }) |
|
|
|
toVariablePayload(stats, { option: { text: ALL_VARIABLE_TEXT, value: ALL_VARIABLE_VALUE, selected: false } }) |
|
|
|
), |
|
|
|
), |
|
|
|
variableStateCompleted(toVariablePayload(stats)), |
|
|
|
variableStateCompleted(toVariablePayload(stats)), |
|
|
|
|
|
|
|
setCurrentVariableValue( |
|
|
|
|
|
|
|
toVariablePayload(stats, { option: { text: ['response'], value: ['response'], selected: false } }) |
|
|
|
|
|
|
|
), |
|
|
|
variableStateFetching(toVariablePayload(substats)), |
|
|
|
variableStateFetching(toVariablePayload(substats)), |
|
|
|
updateVariableOptions( |
|
|
|
updateVariableOptions( |
|
|
|
toVariablePayload(substats, { results: [{ text: '200' }, { text: '500' }], templatedRegex: '' }) |
|
|
|
toVariablePayload(substats, { results: [{ text: '200' }, { text: '500' }], templatedRegex: '' }) |
|
|
|
@ -232,7 +236,12 @@ describe('shared actions', () => { |
|
|
|
option: { text: [ALL_VARIABLE_TEXT], value: [ALL_VARIABLE_VALUE], selected: true }, |
|
|
|
option: { text: [ALL_VARIABLE_TEXT], value: [ALL_VARIABLE_VALUE], selected: true }, |
|
|
|
}) |
|
|
|
}) |
|
|
|
), |
|
|
|
), |
|
|
|
variableStateCompleted(toVariablePayload(substats)) |
|
|
|
variableStateCompleted(toVariablePayload(substats)), |
|
|
|
|
|
|
|
setCurrentVariableValue( |
|
|
|
|
|
|
|
toVariablePayload(substats, { |
|
|
|
|
|
|
|
option: { text: [ALL_VARIABLE_TEXT], value: [ALL_VARIABLE_VALUE], selected: false }, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
) |
|
|
|
); |
|
|
|
); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|