mirror of
https://github.com/grafana/grafana.git
synced 2025-08-02 06:12:59 +08:00

* 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
48 lines
1.1 KiB
TypeScript
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.*/',
|
|
},
|
|
},
|
|
},
|
|
});
|
|
});
|
|
});
|