From 7683181b744b9d5186e65a01f9baf56085465d17 Mon Sep 17 00:00:00 2001 From: Jordan Klassen Date: Mon, 5 Oct 2015 13:44:34 -0700 Subject: [PATCH] Add mocha TDD interface cheatsheet Also add extra links --- mocha-tdd.md | 46 ++++++++++++++++++++++++++++++++++++++++++++++ mocha.md | 2 ++ 2 files changed, 48 insertions(+) create mode 100644 mocha-tdd.md diff --git a/mocha-tdd.md b/mocha-tdd.md new file mode 100644 index 000000000..e3df4a828 --- /dev/null +++ b/mocha-tdd.md @@ -0,0 +1,46 @@ +--- +title: Mocha.js - TDD interface +layout: default +--- + +### TDD + + 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 + + * [Mocha BDD](mocha.html) + * [Mocha HTML](mocha-html.html) + * [Chai](chai.html) + * [Sinon](sinon.html) + * [Sinon Chai](sinon-chai.html) diff --git a/mocha.md b/mocha.md index 3ab240d0d..926a1a22d 100644 --- a/mocha.md +++ b/mocha.md @@ -36,6 +36,8 @@ layout: default ### See also + * [Mocha TDD](mocha.html) + * [Mocha HTML](mocha-html.html) * [Chai](chai.html) * [Sinon](sinon.html) * [Sinon Chai](sinon-chai.html)