mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Convert a test from enzyme to testing library (#49492)
This commit is contained in:
parent
5557d2e666
commit
f93ad85b08
@ -173,9 +173,6 @@ exports[`no enzyme tests`] = {
|
||||
"public/app/features/dimensions/editors/ThresholdsEditor/ThresholdsEditor.test.tsx:4164297658": [
|
||||
[0, 17, 13, "RegExp match", "2409514259"]
|
||||
],
|
||||
"public/app/features/explore/RichHistory/RichHistoryStarredTab.test.tsx:523695501": [
|
||||
[0, 17, 13, "RegExp match", "2409514259"]
|
||||
],
|
||||
"public/app/features/folders/FolderSettingsPage.test.tsx:1109052730": [
|
||||
[0, 19, 13, "RegExp match", "2409514259"]
|
||||
],
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { mount } from 'enzyme';
|
||||
import { render } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
|
||||
import { SortOrder } from 'app/core/utils/richHistory';
|
||||
@ -44,27 +44,27 @@ const setup = (activeDatasourceOnly = false) => {
|
||||
},
|
||||
};
|
||||
|
||||
const wrapper = mount(<RichHistoryStarredTab {...props} />);
|
||||
return wrapper;
|
||||
const container = render(<RichHistoryStarredTab {...props} />);
|
||||
return container;
|
||||
};
|
||||
|
||||
describe('RichHistoryStarredTab', () => {
|
||||
describe('sorter', () => {
|
||||
it('should render sorter', () => {
|
||||
const wrapper = setup();
|
||||
expect(wrapper.find({ 'aria-label': 'Sort queries' })).toHaveLength(1);
|
||||
const container = setup();
|
||||
expect(container.queryByLabelText('Sort queries')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
describe('select datasource', () => {
|
||||
it('should render select datasource if activeDatasourceOnly is false', () => {
|
||||
const wrapper = setup();
|
||||
expect(wrapper.find({ 'aria-label': 'Filter queries for data sources(s)' }).exists()).toBeTruthy();
|
||||
const container = setup();
|
||||
expect(container.queryByLabelText('Filter queries for data sources(s)')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should not render select datasource if activeDatasourceOnly is true', () => {
|
||||
const wrapper = setup(true);
|
||||
expect(wrapper.find({ 'aria-label': 'Filter queries for data sources(s)' }).exists()).toBeFalsy();
|
||||
const container = setup(true);
|
||||
expect(container.queryByLabelText('Filter queries for data sources(s)')).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user