5
Mocha.js TDD interface cheatsheet
source link: https://devhints.io/mocha-tdd
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
This is Devhints.io cheatsheets — a collection of cheatsheets I've written.
mocha.setup('tdd');
suite('something', function() {
setup(function() {
});
test('should work', function() {
});
teardown(function() {
});
});
Async
test('should save', function(done) {
var user = new User();
user.save(function(err) {
if (err) throw err;
done();
});
});
Chai: Expect
var expect = chai.expect;
expect(foo).to.be.a('string');
expect(foo).to.equal('bar');
expect(foo).to.have.length(3);
expect(tea).to.have.property('flavors').with.length(3);
See also
Devhints.io cheatsheets is a collection of cheatsheets I've written over the years. Suggestions and corrections? Send them in.
I'm Rico Sta. Cruz. Check out my Today I learned blog for more.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK