Created
June 7, 2017 00:35
-
-
Save bmorelli25/2d292f88d7341522a1e1c02dd1bb4136 to your computer and use it in GitHub Desktop.
How to test Node.js with Mocha
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
// Require the built in 'assertion' library | |
var assert = require('assert'); | |
// Create a group of tests about Arrays | |
describe('Array', function() { | |
// Within our Array group, Create a group of tests for indexOf | |
describe('#indexOf()', function() { | |
// A string explanation of what we're testing | |
it('should return -1 when the value is not present', function(){ | |
// Our actual test: -1 should equal indexOf(...) | |
assert.equal(-1, [1,2,3].indexOf(4)); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment