Photo by Lăzuran Călin from

in part 1, we learned different types of tests and some of the testing tools. If you haven’t read Part 1, I suggest you read it first:

Test React applications using Jest and Enzyme

First of all, we need to install Jest and Enzyme on our project using npm, as we know testing is a development based task and because of this we are using — save-dev flag to add it to our dev-dependencies section in package.json:

Photo by @serjosoza from

Nowadays developers and tech recruiters are talking about Test Driven Development in everywhere; In the job descriptions, conferences, job interviews and so on. but I think the main importance of understanding how to and why to write tests is in the project maintenance and long-term development.

Long-term development with a team (every developer writes different parts of code which different ingredients binding and collaborating together at the end) and confidence in deploying a project to production without writing and running code is a nightmare!

So, anyway, we have to learn writing and using test. and this article is an easy…

by Negative Space @ pexels

Maybe you would like to build a discount system for your online store or platform. In the first look, It seems a little scary and complicated, but it’s so easy in NodeJs/MongoDB based systems!
First of all, You need to add a discount model to your model’s folder in your product ready nodeJs project:

var mongoose = require(‘mongoose’);var connection = mongoose.createConnection(“mongodb://localhost/{customName}”);var DiscountCodesSchema = mongoose.Schema({code: { type: String, require: true, unique: true },isPercent: { type: Boolean, require: true, default: true },amount: { type: Number, required: true } // if is percent, then number must be ≤…

Pouya Jabbarisani

JavaScript Developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store