mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: convert Cloud Monitoring Aggregation enzyme tests to RTL (#50326)
This commit is contained in:
parent
50145e1617
commit
8bd56b8226
@ -158,9 +158,6 @@ exports[`no enzyme tests`] = {
|
||||
"public/app/features/users/UsersListPage.test.tsx:2518052139": [
|
||||
[0, 19, 13, "RegExp match", "2409514259"]
|
||||
],
|
||||
"public/app/plugins/datasource/cloud-monitoring/components/Aggregation.test.tsx:3822406835": [
|
||||
[1, 19, 13, "RegExp match", "2409514259"]
|
||||
],
|
||||
"public/app/plugins/datasource/cloudwatch/components/ConfigEditor.test.tsx:227258837": [
|
||||
[0, 19, 13, "RegExp match", "2409514259"]
|
||||
],
|
||||
|
@ -1,10 +1,8 @@
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import { shallow } from 'enzyme';
|
||||
import React from 'react';
|
||||
import { openMenu } from 'react-select-event';
|
||||
import { TemplateSrvStub } from 'test/specs/helpers';
|
||||
|
||||
import { Select } from '@grafana/ui';
|
||||
|
||||
import { ValueTypes, MetricKind } from '../types';
|
||||
|
||||
import { Aggregation, Props } from './Aggregation';
|
||||
@ -39,14 +37,11 @@ describe('Aggregation', () => {
|
||||
};
|
||||
|
||||
it('should not have the reduce values', () => {
|
||||
const wrapper = shallow(<Aggregation {...nextProps} />);
|
||||
const { options } = wrapper.find(Select).props() as any;
|
||||
const [, aggGroup] = options;
|
||||
|
||||
expect(aggGroup.options.length).toEqual(11);
|
||||
expect(aggGroup.options.map((o: any) => o.value)).toEqual(
|
||||
expect.not.arrayContaining(['REDUCE_COUNT_TRUE', 'REDUCE_COUNT_FALSE'])
|
||||
);
|
||||
render(<Aggregation {...nextProps} />);
|
||||
const label = screen.getByLabelText('Group by function');
|
||||
openMenu(label);
|
||||
expect(screen.queryByText('count true')).not.toBeInTheDocument();
|
||||
expect(screen.queryByText('count false')).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
@ -60,12 +55,10 @@ describe('Aggregation', () => {
|
||||
};
|
||||
|
||||
it('should have the reduce values', () => {
|
||||
const wrapper = shallow(<Aggregation {...nextProps} />);
|
||||
const { options } = wrapper.find(Select).props() as any;
|
||||
const [, aggGroup] = options;
|
||||
|
||||
expect(aggGroup.options.length).toEqual(11);
|
||||
expect(aggGroup.options.map((o: any) => o.value)).toEqual(expect.arrayContaining(['REDUCE_NONE']));
|
||||
render(<Aggregation {...nextProps} />);
|
||||
const label = screen.getByLabelText('Group by function');
|
||||
openMenu(label);
|
||||
expect(screen.getByText('none')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user