30 lines
533 B
Markdown
30 lines
533 B
Markdown
|
# .cadoles-slide-title[Écosystème (3/7)]
|
||
|
|
||
|
**Les tests unitaires**
|
||
|
|
||
|
Différentes librairies, différents styles...
|
||
|
|
||
|
[NodeUnit](https://github.com/caolan/nodeunit)
|
||
|
```js
|
||
|
this.MathSuite = {
|
||
|
|
||
|
'should return the square root of 8': function(test) {
|
||
|
test.ok( Math.sqrt(4) === 2, 'It should return 2 !');
|
||
|
test.done();
|
||
|
}
|
||
|
|
||
|
};
|
||
|
```
|
||
|
|
||
|
[Jasmine](https://jasmine.github.io/)
|
||
|
```js
|
||
|
describe('Math', function() {
|
||
|
|
||
|
it('should return the square root of 8', function(done) {
|
||
|
expect( Math.sqrt(4) ).toBe(2);
|
||
|
done();
|
||
|
});
|
||
|
|
||
|
});
|
||
|
```
|