Book Image

Node.js Blueprints

By : Krasimir Stefanov Tsonev
Book Image

Node.js Blueprints

By: Krasimir Stefanov Tsonev

Overview of this book

Table of Contents (19 chapters)
Node.js Blueprints
About the Author
About the Reviewers

Classifying tests

There are several types of tests that you may write, which evaluate our system by giving an input and expecting a specific output. However, they also perform this evaluation on different parts. It is good to know their names, which are listed as follows:

  • Unit testing: Unit testing performs checks on a single part of the application; it focuses on one unit. Often, we face difficulties in writing such tests because we can't split our code into units; this is usually a bad sign. If there is no clearly defined module, we can't proceed with such tests. Distributing the logic to different units not only helps in testing but also contributes to the overall stability of the program. Let's illustrate the problem with the following diagram:

    Let's assume we have an e-commerce site that sells products to our users. In the preceding diagram, processes such as log in, ordering, and logout are handled by one class, defined in the App.js file. Yes, it works. We may achieve the goal and...