Skip to content

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

Merged
merged 19 commits into from
Oct 3, 2022

Conversation

PatrykBuniX
Copy link
Contributor

Migrate some tests to testing-library and fix some ts errors along the way.

@codecov
Copy link

codecov bot commented Oct 3, 2022

Codecov Report

Merging #13781 (8e403ec) into dev (51dc1f1) will decrease coverage by 0.00%.
The diff coverage is 50.00%.

@@            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     

@PatrykBuniX PatrykBuniX marked this pull request as ready for review October 3, 2022 13:38
@PatrykBuniX PatrykBuniX requested review from a team and otto-the-bot as code owners October 3, 2022 13:38
Copy link
Contributor

@atomrc atomrc left a 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">
Copy link
Contributor

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')

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure!

@PatrykBuniX PatrykBuniX enabled auto-merge (squash) October 3, 2022 14:03
@PatrykBuniX PatrykBuniX merged commit 66258a5 into dev Oct 3, 2022
@PatrykBuniX PatrykBuniX deleted the runfix/ts-strict-errors branch October 3, 2022 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants