GSoC/GCI Archive
Google Code-in 2014 FOSSASIA

Test a nodejs action of mailer

completed by: Namanyay

mentors: Aruna Herath

We have put together a small nodejs server that can send emails using nodemailer.

We don't want to test its working by sending emails and checking our inboxes because its too tedious. So your task will be to add some automated tests to it.

There is a test already there that does not work. But it can be revamped to a good working test.

Use mocha to run this test.

cd mailer
npm install -g mocha
mocha tests/

Important part of the task is using sinon js, specially sinon js spies to spy the mailer modules send function. And test if its called and called with the correct parameters.

github repo(https://github.com/fossasia/mailer)

sinon js(http://sinonjs.org/)

mocha(http://mochajs.org/)

test that needs some work(https://github.com/fossasia/mailer/blob/master/tests/testRootPost.js#L5)