mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
* value field more human readable Signed-off-by: kisc <nuno_kisc@hotmail.com> * fix typo Signed-off-by: Nuno Cardoso <nuno_kisc@hotmail.com> * add function convertSCToNumber Signed-off-by: nunokisc <nuno_kisc@hotmail.com> * add convertSCToNumber test Signed-off-by: nunokisc <nuno_kisc@hotmail.com> * normalize function name Signed-off-by: kisc <nuno_kisc@hotmail.com> * convertScientificNotationToNumber to parsePrometheusFloat Signed-off-by: kisc <nuno_kisc@hotmail.com>
40 lines
1.5 KiB
TypeScript
40 lines
1.5 KiB
TypeScript
import React from 'react';
|
|
import { shallow } from 'enzyme';
|
|
import AlertsContent from './AlertContents';
|
|
|
|
describe('AlertsContent', () => {
|
|
const defaultProps = {
|
|
groups: [],
|
|
statsCount: {
|
|
inactive: 0,
|
|
pending: 0,
|
|
firing: 0,
|
|
},
|
|
};
|
|
const wrapper = shallow(<AlertsContent {...defaultProps} />);
|
|
|
|
it('matches a snapshot', () => {
|
|
expect(wrapper).toMatchSnapshot();
|
|
});
|
|
|
|
[
|
|
{ selector: '#inactive-toggler', propName: 'inactive' },
|
|
{ selector: '#pending-toggler', propName: 'pending' },
|
|
{ selector: '#firing-toggler', propName: 'firing' },
|
|
].forEach(testCase => {
|
|
it(`toggles the ${testCase.propName} checkbox from true to false when clicked and back to true when clicked again`, () => {
|
|
wrapper.find(testCase.selector).invoke('onClick')(testCase.propName);
|
|
expect(wrapper.find(testCase.selector).prop('checked')).toBe(false);
|
|
wrapper.find(testCase.selector).invoke('onClick')(testCase.propName);
|
|
expect(wrapper.find(testCase.selector).prop('checked')).toBe(true);
|
|
});
|
|
});
|
|
|
|
it('toggles the "annotations" checkbox from false to true when clicked and back to false when clicked again', () => {
|
|
wrapper.find('#show-annotations-toggler').invoke('onClick')();
|
|
expect(wrapper.find('#show-annotations-toggler').prop('checked')).toBe(true);
|
|
wrapper.find('#show-annotations-toggler').invoke('onClick')();
|
|
expect(wrapper.find('#show-annotations-toggler').prop('checked')).toBe(false);
|
|
});
|
|
});
|