Skip to content

Instantly share code, notes, and snippets.

@FagnerMartinsBrack
Created November 22, 2018 10:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FagnerMartinsBrack/6c975dc1f2a3d0b199e7a4cb0d7746ab to your computer and use it in GitHub Desktop.
Save FagnerMartinsBrack/6c975dc1f2a3d0b199e7a4cb0d7746ab to your computer and use it in GitHub Desktop.
(Medium) - How TDD Can Prevent Over-Engineering
let interestAmount = Money('$0.00');
if (loanAmount.greaterThan(Money('$2000.00')) && loanAmount.lessThan(Money('$5001.00'))) {
interestAmount = interestAmount.plus(calculateInterest(loanAmount, greaterThan2000));
}
if (loanAmount.greaterThan(Money('$5000.00')) && loanAmount.lessThan(Money('$10001.00'))) {
interestAmount = interestAmount.plus(calculateInterest(loanAmount, greaterThan2000));
interestAmount = interestAmount.plus(calculateInterest(loanAmount, greaterThan5000));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment