Lab 8 – Unit Testing

For this lab we created unit testing for the functions we created in the previous lab. In this lab we were supposed to code the two functions that we described in “seneca.js” file namely –

  • isValidEmail(x)
  • formatSenecaEmail(x)

Here is my Github repository –

https://github.com/rkgupta21/Seneca2017LearningLab

The idea was to make test cases and make them to pass through these functions and then compare the results that were given by these functions. We needed to upgrade the functions and provide better error handling. If the test case had a leading or trailing spaces it should throw and exception or false.

Here is the updated code for isValidEmail  and formatSenecaEmail –

Capture246

My final travis build file – https://travis-ci.org/rkgupta21/Seneca2017LearningLab

lab8

Overall it was really a good experience do this lab. I realized the importance of unit testing and its importance in everyday life. I have done unit testing before in my java course as well. I found jest to be useful and will try out more stuff with it.

Leave a comment