This Mocha and Node JS tutorial shows you how to test a Node.js and MongoDB backend for a mobile application. This article is part of a series of mobile application development tutorials that I have been publishing on my blog MiamiCoder.com, where we are creating a Meeting Room Booking mobile application with a Node.js and MongoDB backend.
In the previous article of this series, we built the server-side AccountController module that will handle the user registration, login and logout features of the application. We implemented the AccountController’s public interface, along with a number of helper Classes that will allow the Controller to do its work. Our goal for this article is to create a set of unit tests for the Controller’s public interface (public methods) that will prevent us from breaking the application if we need to refactor the Controller in the future.