3 javascript libraries in 5 minutes and 45 secondes

fernan_s
141 views

Open Source Your Knowledge, Become a Contributor

Technology knowledge has to be shared and made accessible for free. Join the movement.

Create Content

Mocha.js

What is Mocha ?

Mocha is an easy JavaScript unit testing framework. It helps you validate the output of a function in a couple ways: to make sure it works as expected and to verify that updates don't break existing code.

Tests use the Assert module. In a nutshell, an assert function that fails (returns false) will make the test fail. Using the Assert module, you can compare the actual output of a function to the expected output.

In this example, you will need to correct the tests in order to correctly validate the add function.

Fix the unit tests

For more information on Mocha, follow this link.

Open Source Your Knowledge: become a Contributor and help others learn. Create New Content
1
2
function add(nb1, nb2) {
return nb1 + nb2;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX