FOSSASIA

FOSSASIA GCI Invitation App: Unit tests

fossasia-gci-invite is a small app that we use to send out invitations for joining FOSSASIA Github team for GCI students. Objective of this task is to write tests for it.

Info

When the app works it makes requests to the Github API. But for testing we like to avoid making network requests. So that we can run tests offline and run tests quickly.

We achieve this by mocking the Github API. That is pretending that we are calling Github API endpoints but actually just imitating them. We can use nock for this.

Steps

  • Run the app locally following instructions on README. You will have to create an organization on Github with teams if you want to see the app in full action. But that is optional.
  • Learn about mocha and install it globally in your computer.
  • Learn about nock and how to use it to mock the requests.
  • Write mocha tests to test the app for the case of a successful invitation.
  • Submit a PR and get it merged!

repo: https://github.com/roonyh/fossasia-gci-invite
mocha: https://mochajs.org/
nock: https://github.com/pgte/nock

Task tags

  • mocha
  • testing
  • javascript
  • nodejs

Students who completed this task

Seva Zhidkov, Yago González

Task type

  • code Code
  • done_all Quality Assurance
close

2015