Skip to content

Commit

Permalink
Migrate ChevronDown from enzyme to RTL (jaegertracing#1961)
Browse files Browse the repository at this point in the history
## Which problem is this PR solving?
Fixes part of jaegertracing#1668

## Description of the changes
Migrates the test for `ChevronDown.tsx` to RTL

## How was this change tested?
Ran the test suite locally

## Checklist
- [X] I have read
https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [X] I have signed all commits
- [X] I have added unit tests for the new functionality
- [X] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `yarn lint` and `yarn test`

Signed-off-by: Eshaan Aggarwal <96648934+EshaanAgg@users.noreply.github.com>
  • Loading branch information
EshaanAgg committed Nov 11, 2023
1 parent 87e22ff commit 9d14f28
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
// limitations under the License.

import React from 'react';
import { shallow } from 'enzyme';
import { IoChevronDown } from 'react-icons/io5';
import { render } from '@testing-library/react';
import '@testing-library/jest-dom';

import ChevronDown from './ChevronDown';

Expand All @@ -24,14 +24,14 @@ describe('ChevronDown', () => {
const style = {
border: 'black solid 1px',
};
const wrapper = shallow(<ChevronDown className={className} style={style} />);
const { container } = render(<ChevronDown className={className} style={style} />);

expect(wrapper.hasClass(className)).toBe(true);
expect(wrapper.find(IoChevronDown).prop('style')).toBe(style);
expect(container.firstChild).toHaveClass(className);
expect(container.firstChild).toHaveStyle(style);
});

it('does not add `undefined` as a className when not given a className', () => {
const wrapper = shallow(<ChevronDown />);
expect(wrapper.hasClass('undefined')).toBe(false);
const { container } = render(<ChevronDown />);
expect(container.firstChild).not.toHaveClass('undefined');
});
});

0 comments on commit 9d14f28

Please sign in to comment.