Skip to content

Instantly share code, notes, and snippets.

@chatrjr
Created December 7, 2012 01:27
Show Gist options
  • Select an option

  • Save chatrjr/4229999 to your computer and use it in GitHub Desktop.

Select an option

Save chatrjr/4229999 to your computer and use it in GitHub Desktop.
An example of a simple unit test written with Mocha and expect.js.
var expect = require("expect.js");
describe('A simple unit test', function () {
it('should add two integers and return the sum', function () {
// implementation to go here
expect(add(3, 9)).to.be(12);
expect(add('a', 8)).to.not.be.a('number');
expect(add.length).to.be(2);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment