-
Notifications
You must be signed in to change notification settings - Fork 293
runfix: refactor tests and fix ts strict errors #13781
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report
@@ Coverage Diff @@
## dev #13781 +/- ##
==========================================
- Coverage 39.08% 39.07% -0.01%
==========================================
Files 568 568
Lines 21044 21050 +6
Branches 4543 4546 +3
==========================================
+ Hits 8225 8226 +1
- Misses 11836 11839 +3
- Partials 983 985 +2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a single suggestion. The rest looks really nice 😎
@@ -41,11 +41,11 @@ const CallMessage: React.FC<CallMessageProps> = ({message}) => { | |||
<div className="message-header"> | |||
<div className="message-header-icon message-header-icon--svg"> | |||
{isCompleted ? ( | |||
<div className="svg-green"> | |||
<div data-uie-name="pickup-icon" className="svg-green"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not use uie-names
only for our unit test. They have a meaning for QA, so we should try to have only qa related ones in the code.
Instead, I'd suggest you mock the Icon
and render a specific text (instead of the actual icon) and use getByText
. You can inspire from this (https://github.com/wireapp/wire-webapp/blob/dev/src/script/components/MessagesList/Message/CallMessage.test.tsx#L25) (but avoiding using the class
here, rather some text).
jest.mock('Components/Icon', () => ({
Hangup: function HangupIcon() {
return <span>hangupIcon</span>;
},
Pickup: function PickupIcon() {
return <span>pickupIcon</span>;
},
}));
And later:
getByText('hangupIcon')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure!
Migrate some tests to testing-library and fix some ts errors along the way.