The Importance of a Unit Test (Making Another Attempt to Fix the Reputation)

The Importance of a Unit Test (Making Another Attempt to Fix the Reputation)

A few days ago, my PR was finally merged after more than two years (thank you @ety001). It is a good sign that the new SteemIt team is better as they review and care the contributions from the community.

However, when I wrote the implementation in PHP, I noticed that the Reputation needs to be returning 25 when 0 is given.

I checked the previous implementation (version 0.7.7): the reputation will return 25 when 0 is given: https://github.com/steemit/steem-js/releases/tag/v0.7.7

Run Code on SteemJs Editor

image.png

However, the PR introduced a different behaviour - when 0 is fed into the function, it will return NaN due to Log10. Unfortunately, when there were no relevant unit tests, I couldn’t spot this difference.

Thus, I have made another PR, which fixes this inconsistence and adds a few unit tests to ensure the behaviour stays the same.

https://github.com/steemit/steem-js/pull/479/files


Every little helps! I hope this helps!

Steem On!~

If you like my work, please consider voting for me, thanks!
https://steemit.com/~witnesses type in justyy and click VOTE



Alternatively, you could proxy to me if you are too lazy to vote!

Also: you can vote me at the tool I made: https://steemyy.com/witness-voting/?witness=justyy

Visit me at: https://steemyy.com


This page is synchronized from the post: ‘The Importance of a Unit Test (Making Another Attempt to Fix the Reputation)’

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×