Skip to content

Instantly share code, notes, and snippets.

@ParthDesai
Created September 21, 2015 04:22
Show Gist options
  • Save ParthDesai/4c4da060d64e49700085 to your computer and use it in GitHub Desktop.
Save ParthDesai/4c4da060d64e49700085 to your computer and use it in GitHub Desktop.
A sample test using mocha and chai. To execute, add it into your directory and make sure file name contains a string "test".
'use strict';
var chai = require('chai');
var expect = chai.expect;
describe('Array', function() {
describe('#indexOf()', function () {
it('should return -1 when the value is not present', function () {
expect([1,2,3].indexOf(5)).to.equal(-1);
expect([1,2,3].indexOf(0)).to.equal(-1);
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment