Permalink
Browse files

added mocha and should npm package; added Makefile to simplify runnin…

…g tests; added simple not-yet-complete test file into the test folder
  • Loading branch information...
1 parent 3b276fa commit 3aa2f95bf442a82be7afa4072a939f5f812b79f2 @philippkueng philippkueng committed Feb 26, 2012
Showing with 33 additions and 0 deletions.
  1. +4 −0 Makefile
  2. +7 −0 package.json
  3. +22 −0 test/test.nddb.js
View
@@ -0,0 +1,4 @@
+test:
+ @./node_modules/.bin/mocha
+
+.PHONY: test
View
@@ -10,10 +10,17 @@
"dependencies": {
"JSUS": ">= 0.1.0"
},
+ "devDependencies": {
+ "mocha": ">= 0.3.0",
+ "should": ">= 0.5.1"
+ },
"engines": { "node": ">=0.2.3" },
"main": "nddb.js",
"repository": {
"type": "git",
"url": "https://github.com/nodeGame/NDDB.git"
+ },
+ "scripts": {
+ "test": "make test"
}
}
View
@@ -0,0 +1,22 @@
+var util = require('util'),
+ should = require('should'),
+ NDDB = require('./../nddb').NDDB;
+ var db = new NDDB();
+
+describe('NDDB', function(){
+ describe('empty NDDB', function(){
+ it('should return length 0 when instantiating an empty DB', function(){
+ db.size().should.equal(0);
+ });
+ });
+
+ describe('filled NDDB', function(){
+ before(function(){
+ // insert a single object
+ db.insert({'name':'foobar'});
+ });
+ it('should return length 1 when inserting an object', function(){
+ db.size().should.equal(1);
+ });
+ });
+});

0 comments on commit 3aa2f95

Please sign in to comment.