Last active
December 19, 2015 07:09
-
-
Save colinmeinke/5916573 to your computer and use it in GitHub Desktop.
Mocha Chai unit testing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load the assertion library | |
var chai = require('chai'), | |
should = chai.should(); | |
describe('Hello world example', function() { | |
// This should pass | |
it('should be a string', function() { | |
var hello_world = 'hello world'; | |
hello_world.should.be.a('string'); | |
}); | |
// This should pass | |
it('should have length of 11', function() { | |
var hello_world = 'hello world'; | |
hello_world.should.have.length(11); | |
}); | |
// This should fail | |
it('should equal "not even close"', function() { | |
var hello_world = 'hello world'; | |
hello_world.should.equal('not even close'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment