rsm-hcd / AndcultureCode.JavaScript.React

Common patterns, functions, etc... used when building react applications
6 stars 8 forks source link

Fix flaky use-async-effect tests #58

Closed brandongregoryscott closed 3 years ago

brandongregoryscott commented 3 years ago

Fixes #50 use-async-effect.ts test flakes

Update use-async-effect tests to call 'unmount' function returned by component render, vs. relying on globally provided 'cleanup' function

brandongregoryscott commented 3 years ago

@myty I believe unmount() returned from a render() is the proper thing to force an unmount at a specific point. I've not seen cleanup used in our codebase yet. It looks like test runners that support afterEach hooks will call this automatically, so we don't need to worry about memory leaks/manual cleanup. https://testing-library.com/docs/react-testing-library/setup/#skipping-auto-cleanup

codecov[bot] commented 3 years ago

Codecov Report

Merging #58 (89e3351) into main (c5d148b) will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main      #58   +/-   ##
=======================================
  Coverage   94.62%   94.62%           
=======================================
  Files          16       16           
  Lines         242      242           
  Branches       27       27           
=======================================
  Hits          229      229           
  Misses         12       12           
  Partials        1        1           

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update c5d148b...9e4d380. Read the comment docs.