During the past year and as part of our philosophy of continuous improvement, we have been conducting various shared-training sessions, in which our team members themselves share their knowledge, experiences and ideas. As we know, constant training and continuous learning are essential to keep up to date in a constantly evolving technological world.

In this series of posts, we will discuss some key aspects of these sessions.

Training Pill 02:

Unit testing in application deployment

Teach:

Beatríz González

Necessary tools

Ponicode: Visual Studio Code plugin for automatic unit testing.

Installation: from VsCode extensions or from https://www.ponicode.com.

Rewire: Installation: npm i rewire

Jest: Unit testing framework for Javascript.

Installation: npm i jest

 

Step 1: Generating tests with Ponicode

We go to the function we want to test and click on Ponicode: Unit Test.

Step 2: Execution of the generated tests

We add “test”: “jest –verbose” in package.json in the scripts part.

Execute using: npm run test

Step 3: Integration in the deployment

We add the following in docker-compose.yml.

 

Admin