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": [
|
"public/app/features/dimensions/editors/ThresholdsEditor/ThresholdsEditor.test.tsx:4164297658": [
|
||||||
[0, 17, 13, "RegExp match", "2409514259"]
|
[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": [
|
"public/app/features/folders/FolderSettingsPage.test.tsx:1109052730": [
|
||||||
[0, 19, 13, "RegExp match", "2409514259"]
|
[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 React from 'react';
|
||||||
|
|
||||||
import { SortOrder } from 'app/core/utils/richHistory';
|
import { SortOrder } from 'app/core/utils/richHistory';
|
||||||
@ -44,27 +44,27 @@ const setup = (activeDatasourceOnly = false) => {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const wrapper = mount(<RichHistoryStarredTab {...props} />);
|
const container = render(<RichHistoryStarredTab {...props} />);
|
||||||
return wrapper;
|
return container;
|
||||||
};
|
};
|
||||||
|
|
||||||
describe('RichHistoryStarredTab', () => {
|
describe('RichHistoryStarredTab', () => {
|
||||||
describe('sorter', () => {
|
describe('sorter', () => {
|
||||||
it('should render sorter', () => {
|
it('should render sorter', () => {
|
||||||
const wrapper = setup();
|
const container = setup();
|
||||||
expect(wrapper.find({ 'aria-label': 'Sort queries' })).toHaveLength(1);
|
expect(container.queryByLabelText('Sort queries')).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('select datasource', () => {
|
describe('select datasource', () => {
|
||||||
it('should render select datasource if activeDatasourceOnly is false', () => {
|
it('should render select datasource if activeDatasourceOnly is false', () => {
|
||||||
const wrapper = setup();
|
const container = setup();
|
||||||
expect(wrapper.find({ 'aria-label': 'Filter queries for data sources(s)' }).exists()).toBeTruthy();
|
expect(container.queryByLabelText('Filter queries for data sources(s)')).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not render select datasource if activeDatasourceOnly is true', () => {
|
it('should not render select datasource if activeDatasourceOnly is true', () => {
|
||||||
const wrapper = setup(true);
|
const container = setup(true);
|
||||||
expect(wrapper.find({ 'aria-label': 'Filter queries for data sources(s)' }).exists()).toBeFalsy();
|
expect(container.queryByLabelText('Filter queries for data sources(s)')).not.toBeInTheDocument();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user