Permalink
Browse files

delete test db after tests complete

  • Loading branch information...
1 parent 3f4b4b3 commit aeaaf7096796ba04686e123ec71d5762ad5429cc @aheckmann aheckmann committed Apr 17, 2011
Showing with 23 additions and 3 deletions.
  1. +23 −3 test/index.js
View
@@ -120,6 +120,20 @@ function makeapp () {
function assignExports () {
+ /**
+ * Clean up the test db when finished.
+ */
+
+ var testsrunning = 3;
+ function finishTest () {
+ if (--testsrunning) return;
+ var db = connect();
+ db.db.dropDatabase(function () {
+ db.close();
+ });
+ }
+
+
exports['test render'] = function () {
var app = makeapp();
var db = connect();
@@ -193,7 +207,9 @@ function assignExports () {
var pending = 6;
function done () {
- --pending || db.close();
+ if (--pending) return;
+ db.close();
+ finishTest();
}
assert.response(app,
@@ -328,7 +344,9 @@ function assignExports () {
var pending = 6;
function done () {
- --pending || db.close();
+ if (--pending) return;
+ db.close();
+ finishTest();
}
assert.response(app,
@@ -430,7 +448,9 @@ function assignExports () {
var pending = 6;
function done () {
- --pending || db.close();
+ if (--pending) return;
+ db.close();
+ finishTest();
}
assert.response(app,

0 comments on commit aeaaf70

Please sign in to comment.