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

in witness-category •  4 years ago 

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

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  
  ·  4 years ago 

给行长拍拍

  ·  4 years ago 

谢谢

Wow to get a post in English or Spanish in the trend zone is a great challenge .. haha.
I think that steemit has to improve in some respects with the new modality that they have created. I know that the new steemit team is giving their best to bring this ship afloat after a big storm. After getting used to the old function of steemit and seeing all the changes made by the new team makes it difficult for me to adapt a little.
I see that you are giving your contribution to the team. I congratulate you, person like you, who needs steemit to improve.

  ·  4 years ago 

Thank you. there is still a long way to go.

If you have to go one step at a time, the road is long and you can get obstacles on the road that can be overcome little by little.
A question! I imagine that you have contact with the members of steemit.
What possibilities are there to create 2 types of trends?

  • One that is for the Asian area and one for the rest of the world.

    Is it possible to do that?

  ·  4 years ago 

I don't have a solution for that yet. but I will make sure your voice is heard. Thanks for your suggestion!

thanks for using #codeonsteem , fully upvoted with my trail around $4

thank you for being awesome

  ·  4 years ago 

Thank you.