[Utopian.js] - Mocha & Chai unit test

in #utopian-io7 years ago (edited)

Screen Shot 2018-02-10 at 4.20.17 PM.png

This library provide a easy way to use methods on the Utopian API without any interaction of backend of a nodejs environment. Simply, you add a script tag linked to the CDN version of the library or a locally minified version of the script and you can run the methods directly in your script.

New Features


As we already know, manually testing of the methods in the script is not an efficient way to ensure functionality of the script. So, I write unit test for each one of the methods available in the script. Those were written using Mocha and Chai and are displayed in a HTML page. Basically, each test describe the function and what it is expected to return. By using assertion , it compares the datatype of the response with the expected datatype.

To ensure a more concrete result, I also added lines to assert some of the attributes in the response to ensure that the datatype is the correct one.

What are the benefits of unit test? Simple, when you make changes to the library, you just need to run the test and if all methods passed the test, the library is ready for deployment. Hence, not manually testing is needed by having the unit test.

In Brief: Mocha and Chai were added for unit testing in the library.



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Thank you for the contribution. It has been approved.

You can contact us on Discord.
[utopian-moderator]

Thank you so much :)

Great work with the tests.

Thank you brother from another mother and another timezone :)

Hey @jaysermendez I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x

Nice post.I respect you very much because you contribute to steemit.I will do activities like you.I would like to extend the steemit..

Coin Marketplace

STEEM 0.16
TRX 0.16
JST 0.032
BTC 59304.77
ETH 2534.68
USDT 1.00
SBD 2.41