neherlab / covid19_scenarios

Models of COVID-19 outbreak trajectories and hospital demand
https://covid19-scenarios.org
MIT License
1.36k stars 354 forks source link

Refactor computeNewEmpiricalCases into module with unit tests. #677

Closed abrie closed 4 years ago

abrie commented 4 years ago

Related issues and PRs

Related to this Fixme, an incremental refactoring of the DeterministicLinePlot component.

(Additional context: #636, #671)

Description

Reduce the code complexity of DeterministicLinePlot.tsx by extracting the computeNewEmpiricalCases() methods into a utility module. Also adds units tests for the method to aid future refactoring.

Impacted Areas in the application

Slight reorganization of the code. Adds more unit tests.

Testing

Adds units tests for computenewEmpiricalCases in the Utils.ts module.

Run yarn test to test.

vercel[bot] commented 4 years ago

This pull request is being automatically deployed with Vercel (learn more). To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/covid19-scenarios/covid19-scenarios/e0g8b1i9g ✅ Preview: https://covid19-scenarios-git-fork-abrie-refactor-deterministiclineplot.covid19-scenarios.now.sh

codeclimate[bot] commented 4 years ago

Code Climate has analyzed commit d14fb94f and detected 0 issues on this pull request.

View more on Code Climate.

codecov[bot] commented 4 years ago

Codecov Report

Merging #677 into master will increase coverage by 0.76%. The diff coverage is 91.30%.

@@            Coverage Diff             @@
##           master     #677      +/-   ##
==========================================
+ Coverage   24.87%   25.63%   +0.76%     
==========================================
  Files         128      128              
  Lines        2762     2762              
  Branches      393      393              
==========================================
+ Hits          687      708      +21     
+ Misses       2075     2054      -21     
Impacted Files Coverage Δ
.../components/Main/Results/DeterministicLinePlot.tsx 0.00% <0.00%> (ø)
src/components/Main/Results/Utils.ts 96.66% <95.45%> (-3.34%) :arrow_down: