jQuery powered unit test

by fresheyeball

HTML

<script src="//cdnjs.cloudflare.com/ajax/libs/mocha/1.12.1/mocha.js"></script>
<script src="http://code.angularjs.org/1.1.5/angular.js"></script>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/mocha/1.12.1/mocha.css">
<script src="http://chaijs.com/chai.js"></script>
<!-- We are going to use Mocha + Chai setup for testing -->
<script>
    mocha.setup('bdd');
</script>
<body>
    <div id="mocha"></div>
</body>
<!-- Adding angular mocks to have 'module' and 'inject' functions -->
<script src="http://code.angularjs.org/1.1.5/angular-mocks.js"></script>

CoffeeScript

mutliplyByThree = (x) -> x * 3

{expect} = chai

describe 'multiply by three', ->
  it 'should turn 2 into 6', ->
    expect(mutliplyByThree 2).to.equal 6
  it 'should turn 3 into 9', ->
    expect(mutliplyByThree 4).to.equal 9
    
mocha.run()