Mocha supports several different ways of writing tests (interfaces) so that you can choose a style that suits your methodology. describe()
and suite()
essentially do the same thing: they let you label and group together a set of tests; the grouped tests are organised under a common label in the output and can use common setup and teardown functions.
The choice of which function to use depends on whether you are using a Behaviour Driven Development (BDD) methodology (where you describe()
the behaviour you want it()
to do), or Test Driven Development (TDD), where you define a suite()
of test()
s you want your code to pass. You should choose whichever style you feel makes your code more readable.
Here's a blog explaining the Difference Between TDD and BDD with regard to test design.