Back
Close

3 javascript libraries in 5 minutes and 45 secondes

fernan_s
2,305 views

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.

Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.
Go to tech.io
function add(nb1, nb2) {
return nb1 + nb2;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
codingame x discord
Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
JOIN US ON DISCORD
Online Participants