Permalink
Browse files

[tests] use Makefile so that we can add benchmarking also

  • Loading branch information...
1 parent 4c35424 commit f48c1bfe310bbe5de80a38bde5e53bc1612a6c0e @edwardhotchkiss edwardhotchkiss committed Jan 17, 2012
Showing with 21 additions and 6 deletions.
  1. +7 −0 Makefile
  2. +1 −1 package.json
  3. +13 −5 test/index.test.js
View
7 Makefile
@@ -0,0 +1,7 @@
+
+SHELL := /bin/bash
+
+test:
+ @vows test/index.test.js --spec
+
+.PHONY: test
View
2 package.json
@@ -28,6 +28,6 @@
"url":"http://github.com/edwardhotchkiss/short/LICENSE"
}],
"scripts":{
- "test":"vows test/*.test.js --spec"
+ "test":"make test"
}
}
View
18 test/index.test.js
@@ -1,6 +1,6 @@
/*!
- Core Modules
+ requires
*/
var vows = require('vows'),
@@ -9,15 +9,23 @@ var vows = require('vows'),
short = require('../lib/short');
/*!
- Connect to MongoDB
+ connect to mongodb
*/
-var MONGO_DB_SHORT = process.env.MONGO_DB_SHORT || 'mongodb://localhost/short';
+var MONGO_DB = process.env.MONGO_DB || 'mongodb://localhost/short';
-short.connect(MONGO_DB_SHORT);
+short.connect(MONGO_DB);
+
+short.connection.on('open', function() {
+ console.log('connected to mongodb');
+});
+
+short.connection.on('error', function(error) {
+ throw new Error(error);
+});
/*!
- Vows / npm test
+ add suites to vows
*/
vows.describe('general module tests').addBatch({

0 comments on commit f48c1bf

Please sign in to comment.