cheatsheets/mocha.md

44 lines
742 B
Markdown
Raw Permalink Normal View History

2013-10-14 02:36:58 +00:00
---
title: Mocha.js
2015-11-24 05:02:17 +00:00
category: JavaScript libraries
2013-10-14 02:36:58 +00:00
---
2013-03-25 17:44:24 +00:00
### BDD
mocha.setup('bdd');
describe('something', function() {
beforeEach(function() {
});
it('should work', function() {
});
});
### Async
it('should save', function(done) {
var user = new User();
user.save(function(err) {
if (err) throw err;
done();
});
});
### Chai: Shoulds
chai.should();
foo.should.be.a('string');
foo.should.equal('bar');
foo.should.have.length(3);
tea.should.have.property('flavors').with.length(3);
2014-06-09 05:30:52 +00:00
### See also
2017-04-03 18:41:22 +00:00
* [Mocha TDD](mocha-tdd.html)
* [Mocha HTML](mocha-html.html)
2014-06-09 05:30:52 +00:00
* [Chai](chai.html)
* [Sinon](sinon.html)
* [Sinon Chai](sinon-chai.html)