mirror of
https://github.com/grafana/grafana.git
synced 2025-02-20 11:48:34 -06:00
* CloudWatch: Datasource improvements * Add statistic as template variale * Add wildcard to list of values * Template variable intercept dimension key * Return row specific errors when transformation error occured * Add meta feedback * Make it possible to retrieve values without known metrics * Add curated dashboard for EC2 * Fix broken tests * Use correct dashboard name * Display alert in case multi template var is being used for some certain props in the cloudwatch query * Minor fixes after feedback * Update dashboard json * Update snapshot test * Make sure region default is intercepted in cloudwatch link * Update dashboards * Include ec2 dashboard in ds * Do not include ec2 dashboard in beta1 * Display actual region
51 lines
1.8 KiB
TypeScript
51 lines
1.8 KiB
TypeScript
import React from 'react';
|
|
import { mount, shallow } from 'enzyme';
|
|
import { Dimensions } from './';
|
|
import { SelectableStrings } from '../types';
|
|
|
|
describe('Dimensions', () => {
|
|
it('renders', () => {
|
|
mount(
|
|
<Dimensions
|
|
dimensions={{}}
|
|
onChange={dimensions => console.log(dimensions)}
|
|
loadKeys={() => Promise.resolve<SelectableStrings>([])}
|
|
loadValues={() => Promise.resolve<SelectableStrings>([])}
|
|
/>
|
|
);
|
|
});
|
|
|
|
describe('and no dimension were passed to the component', () => {
|
|
it('initially displays just an add button', () => {
|
|
const wrapper = shallow(
|
|
<Dimensions
|
|
dimensions={{}}
|
|
onChange={() => {}}
|
|
loadKeys={() => Promise.resolve<SelectableStrings>([])}
|
|
loadValues={() => Promise.resolve<SelectableStrings>([])}
|
|
/>
|
|
);
|
|
|
|
expect(wrapper.html()).toEqual(
|
|
`<div class="gf-form"><a class="gf-form-label query-part"><i class="fa fa-plus"></i></a></div>`
|
|
);
|
|
});
|
|
});
|
|
|
|
describe('and one dimension key along with a value were passed to the component', () => {
|
|
it('initially displays the dimension key, value and an add button', () => {
|
|
const wrapper = shallow(
|
|
<Dimensions
|
|
dimensions={{ somekey: 'somevalue' }}
|
|
onChange={() => {}}
|
|
loadKeys={() => Promise.resolve<SelectableStrings>([])}
|
|
loadValues={() => Promise.resolve<SelectableStrings>([])}
|
|
/>
|
|
);
|
|
expect(wrapper.html()).toEqual(
|
|
`<div class="gf-form"><a class="gf-form-label query-part">somekey</a></div><label class="gf-form-label query-segment-operator">=</label><div class="gf-form"><a class="gf-form-label query-part">somevalue</a></div><div class="gf-form"><a class="gf-form-label query-part"><i class="fa fa-plus"></i></a></div>`
|
|
);
|
|
});
|
|
});
|
|
});
|