mozilla / perfcompare

Improved Performance Comparison Tool
Mozilla Public License 2.0
39 stars 93 forks source link

Simplify how the render functions are defined and used in test files #587

Closed julienw closed 9 months ago

julienw commented 9 months ago

Before this patch, we have 2 different render functions: render and renderWithRouter. We also have a StoreProvider that's just react-redux's Provider pre-configured, that we use in some hooks-related test files.

The 2 render functions are "created" in beforeEach and exposed by setupTests. Instead of "creating" them, in this patch they're now defined directly, and they can be imported directly from test-utils in the test files. The goal is that it's now easier to create new flavors for these functions, that I'd like to use in #582.

The store object is imported from setupTests instead of being passed as a parameter. I considered creating it in the render functions (possibly as a default parameter, so that we could pass another store if needed) and returning it, but this would require changing all call sites, so I decided to keep it simple for now. We could always change it more later.

This is on top of #584 and #586 to minimize rebase conflicts, so take care to only look at the few un-labeled commits at the end of the commit list.

netlify[bot] commented 9 months ago

Deploy Preview for mozilla-perfcompare ready!

Name Link
Latest commit 1f79b48b42cbf1f50084d48d0a47049ff380540d
Latest deploy log https://app.netlify.com/sites/mozilla-perfcompare/deploys/65a50667cdc58a000878f500
Deploy Preview https://deploy-preview-587--mozilla-perfcompare.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

codecov[bot] commented 9 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (3d0654a) 99.34% compared to head (1f79b48) 99.34%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## beta #587 +/- ## ======================================= Coverage 99.34% 99.34% ======================================= Files 62 62 Lines 1366 1366 Branches 189 189 ======================================= Hits 1357 1357 Misses 9 9 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.