Eric Schoffstall
I like to code.
Consulting, training, products, professional services
contact@wearefractal.comfunction test(done){
assert.equal(1, 1);
done();
}
var assert = require("assert");
describe('Array', function(){
describe('#indexOf()', function(){
it('should return -1 when the value is not present', function(done){
assert.equal(-1, [1,2,3].indexOf(5));
assert.equal(-1, [1,2,3].indexOf(0));
done();
});
});
});
var assert = require("assert");
suite('Array', function(){
suite('#indexOf()', function(){
test('should return -1 when not present', function(done){
assert.equal(-1, [1,2,3].indexOf(5));
assert.equal(-1, [1,2,3].indexOf(0));
done();
});
});
});
var assert = require("assert");
module.exports = {
'Array': {
'#indexOf()': {
'should return -1 when not present': function(done){
assert.equal(-1, [1,2,3].indexOf(5));
assert.equal(-1, [1,2,3].indexOf(0));
done();
}
}
}
};
describe('Connection', function(){
var db = new Connection();
var tobi = new User('tobi');
// wipe the databse
beforeEach(db.clear);
// seed the database with fake data
beforeEach(function(done){
db.save(tobi, done);
});
describe('#find()', function(){
it('should respond with matching records', function(done){
db.find({ type: 'User' }, function(err, res){
if (err) return done(err);
assert.equal(res.length, 1);
done();
});
});
});
});
npm install -g mocha
git clone https://github.com/wearefractal/mocha-adventure
cd mocha-adventure
cd test/add
mocha .
cd test/subtract
mocha .
cd test/multiply
mocha .
cd test/divide
mocha .
mocha .
By Eric Schoffstall
Testing, Mocha, and More