Chore: convert NewWindowIcon test to rtl (#49830)

This commit is contained in:
Zoltán Bedi 2022-05-31 14:34:46 +02:00 committed by GitHub
parent 4c28d09d6d
commit 8e0342bc74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 28 deletions

View File

@ -98,9 +98,6 @@ exports[`no enzyme tests`] = {
"packages/jaeger-ui-components/src/TraceTimelineViewer/index.test.js:381298544": [
[14, 19, 13, "RegExp match", "2409514259"]
],
"packages/jaeger-ui-components/src/common/NewWindowIcon.test.js:1750458349": [
[14, 19, 13, "RegExp match", "2409514259"]
],
"packages/jaeger-ui-components/src/common/UiFindInput.test.js:2207118020": [
[14, 19, 13, "RegExp match", "2409514259"]
],

View File

@ -10,17 +10,20 @@
},
"devDependencies": {
"@grafana/tsconfig": "^1.2.0-rc1",
"@testing-library/jest-dom": "5.16.4",
"@testing-library/react": "12.1.4",
"@testing-library/user-event": "14.2.0",
"@types/classnames": "^2.2.7",
"@types/deep-freeze": "^0.1.1",
"@types/grafana__slate-react": "npm:@types/slate-react@0.22.5",
"@types/hoist-non-react-statics": "^3.3.1",
"@types/jest": "27.5.1",
"@types/lodash": "4.14.182",
"@types/prop-types": "15.7.5",
"@types/react": "17.0.42",
"@types/react-icons": "2.2.7",
"@types/reselect": "2.2.0",
"@types/testing-library__jest-dom": "5.14.3",
"@types/tinycolor2": "1.4.3",
"enzyme": "3.11.0",
"sinon": "14.0.0",

View File

@ -12,29 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import { shallow } from 'enzyme';
import { render } from '@testing-library/react';
import React from 'react';
import NewWindowIcon, { getStyles } from './NewWindowIcon';
describe('NewWindowIcon', () => {
const props = {
notIsLarge: 'not is large',
};
let wrapper;
beforeEach(() => {
wrapper = shallow(<NewWindowIcon {...props} />);
});
it('renders as expected', () => {
expect(wrapper).toMatchSnapshot();
});
it('adds is-large className when props.isLarge is true', () => {
const { container } = render(<NewWindowIcon isLarge />);
const styles = getStyles();
expect(wrapper.hasClass(styles.NewWindowIconLarge)).toBe(false);
wrapper.setProps({ isLarge: true });
expect(wrapper.hasClass(styles.NewWindowIconLarge)).toBe(true);
expect(container.firstChild).toHaveClass(styles.NewWindowIconLarge);
});
});

View File

@ -1,8 +0,0 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`NewWindowIcon renders as expected 1`] = `
<IoAndroidOpen
className=""
notIsLarge="not is large"
/>
`;

View File

@ -4577,17 +4577,20 @@ __metadata:
"@grafana/e2e-selectors": 9.0.0-pre
"@grafana/tsconfig": ^1.2.0-rc1
"@grafana/ui": 9.0.0-pre
"@testing-library/jest-dom": 5.16.4
"@testing-library/react": 12.1.4
"@testing-library/user-event": 14.2.0
"@types/classnames": ^2.2.7
"@types/deep-freeze": ^0.1.1
"@types/grafana__slate-react": "npm:@types/slate-react@0.22.5"
"@types/hoist-non-react-statics": ^3.3.1
"@types/jest": 27.5.1
"@types/lodash": 4.14.182
"@types/prop-types": 15.7.5
"@types/react": 17.0.42
"@types/react-icons": 2.2.7
"@types/reselect": 2.2.0
"@types/testing-library__jest-dom": 5.14.3
"@types/tinycolor2": 1.4.3
chance: ^1.0.10
classnames: ^2.2.5