grafana/public/app/features/scenes/variables/variants/ObjectVariable.test.ts
Torkel Ödegaard b5651803e0
Scene: ObjectVariable for supporting the built in system variables and object scoped variables (__data for example) (#58291)
* Scene: Adds ObjectVariable to support the built-in/system variables

* fixed lint issue
2022-11-09 10:27:20 +01:00

19 lines
500 B
TypeScript

import { ObjectVariable } from './ObjectVariable';
describe('ObjectVariable', () => {
describe('getValue', () => {
it('it should return value according to fieldPath', () => {
const variable = new ObjectVariable({
name: 'test',
value: {
field1: 'value1',
array: ['value1', 'value2', 'value3'],
},
});
expect(variable.getValue('field1')).toBe('value1');
expect(variable.getValue('array[1]')).toBe('value2');
});
});
});