Add Tests, CI and Standard(code quality checks) in NPM package

in utopian-io •  7 years ago  (edited)

New Features

  • What feature(s) did you add?
    I added tests using ChaiJS and MochaJS.

There are three tests added right now.

  • Moderators Endpoint test
  • Sponsors Endpoint test
  • Posts Endpoint test

Tests log is given below-

$ npm test
> [email protected] test /home/travis/build/ms10398/utopian-api-npm-1
> standard && mocha --reporter spec
  Utopian Moderator Endpoint test
    ✓ Should return a JSON (129ms)
  Utopian Sponsor Endpoint test
    ✓ Should return a JSON (45ms)
  Utopian Posts Endpoint test
    ✓ Should return a JSON (99ms)
  3 passing (284ms)
The command "npm test" exited with 0.

I have also added Travis CI for auto builds of the npm package with every pull request and commit.
Screenshot from 2018-01-20 09-40-17.png

  • How did you implement it/them?

For Tests you can check my code here.

For Travis I configured to run tests and build using npm install.
travis.yml file conten is -

language : node_js
node_js :
 - stable
install:
 - npm install
script:
 - npm test

Bug Fixes

As the project was growing we have to maintain the code quality of the project. So for that I have added standard a npm package for code quality tests.
While adding there was a huge error log which needed to be fixed I have fixed it.
For lazy people standard helps in easy fixes I have mentioned it in readme.



Posted on Utopian.io - Rewarding Open Source Contributors

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:  
  ·  7 years ago (edited)

G00d work kya baat hai

Hey @ms10398 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