Mocha practice

by ncapito

HTML

<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/mocha/1.13.0/mocha.min.css">
<script src="http://chaijs.com/chai.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/mocha/1.13.0/mocha.min.js"></script>
<div id="mocha"></div>

JavaScript

var TEXT_NODE = 3,
    text,
    test;

chai.should();
mocha.setup('bdd');
window.onload = function() {
    mocha.run();
};


describe('Array', function () {
  describe('#indexOf()', function () {
    var myArray = [1, 2, 3]
    it('Should return -1 when the value is not present', function () {
      myArray.indexOf(0).should.equal(-1);     // a - success
      [1, 2, 3].indexOf(0).should.equal(-1)   // b - fails test
    })
    
    
    it('BREAKS: Should return -1 when the value is not present', function () {
      myArray.indexOf(0).should.equal(-1)     // a - success
      [1, 2, 3].indexOf(0).should.equal(-1)   // b - fails test
    })
  })
})