Open oldoc63 opened 2 years ago
If you are testing a Math object with the method .max, you could use the following test code:
Both the describe and it functions accept two parameters: a descriptive string and a callback function. Though the functions are flexible, they are commonly used in the structure above: nest describe blocks to resemble the structure of your implementation code and write individual tests in it blocks. This makes your test suite isolated, maintainable, and expressive.
In mocha we group the test using the describe function and define test using the it function. These two functions can be used to make your test suite complete, maintainable, and expressive in the following ways: