Files
Hugo Häggmark e54fc47462 Variables: Adds variables inspection (#25214)
* Chore: initial commit

* Refactor: adds usages

* Refactor: adds FeatureInfoBox

* Refactor: uses graphs instead

* Refactor: adds id, name, title to prop instead of key

* Refactor: adds usages to VariablesList

* Refactor: Moves unknowns to first page

* Refactor: minor stylings and icons

* Refactor: styling

* Refactor: changed to button with modal

* Refactor: adds VariablesDependenciesButton

* Refactor: changes after UX feedback

* Refactor: renames heading

* Refactor: changes after PR comments

* Refactor: small changes after PR comments
2020-11-05 09:53:27 +01:00

48 lines
1.1 KiB
TypeScript

import { getPropsWithVariable } from './utils';
describe('getPropsWithVariable', () => {
it('when called it should return the correct graph', () => {
const result = getPropsWithVariable(
'$unknownVariable',
{
key: 'model',
value: {
templating: {
list: [
{
current: {
selected: false,
text: 'No data sources found',
value: '',
},
hide: 0,
includeAll: false,
label: null,
multi: false,
name: 'dependsOnUnknown',
options: [],
query: 'prometheus',
refresh: 1,
regex: '/.*$unknownVariable.*/',
skipUrlSync: false,
type: 'datasource',
},
],
},
},
},
{}
);
expect(result).toEqual({
templating: {
list: {
dependsOnUnknown: {
regex: '/.*$unknownVariable.*/',
},
},
},
});
});
});