mongotest

0.1.1 • Public • Published

Integration Testing Helper for MongoDB

Some of the helper function to deal when doing functional testing with mongoDB

Sample with nodeunit

exports.testBasic = function(test) {

var mongo = new Mongotest();
mongo.isStarted(mongo.ensureDeleted("aaa", mongo.ensureDeleted("bbb", function() {
	
	console.log('mongo has been started');

	mongo.db.collection('aaa').find({}).toArray(function(err, vals) {
		
		test.equal(vals.length, 0);
		var id = Math.random();
		mongo.db.collection('aaa').save({_id: id}, function() {
			test.done();
		});
	});

	
})), function() {
	console.log('mongo is not started');
	test.done();
});

};

Dependencies (1)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i mongotest

    Weekly Downloads

    0

    Version

    0.1.1

    License

    none

    Last publish

    Collaborators

    • arunoda