Permalink
Browse files

tests exit cleanly

  • Loading branch information...
1 parent df58767 commit 35e8ccc050cce3967e83175df600044a36d34d10 @Raynos Raynos committed Feb 15, 2013
Showing with 20 additions and 1 deletion.
  1. +2 −1 package.json
  2. +18 −0 test/index.js
View
@@ -26,7 +26,8 @@
"browserify": "https://github.com/raynos/node-browserify/tarball/master",
"testem": "~0.2.56",
"node-uuid": "~1.4.0",
- "callback-reduce": "~1.1.0"
+ "callback-reduce": "~1.1.0",
+ "after": "~0.6.0"
},
"licenses": [
{
View
@@ -1,11 +1,14 @@
var test = require("tape")
var uuid = require("node-uuid")
+var after = require("after")
var expand = require("reducers/expand")
+var fold = require("reducers/fold")
var take = require("reducers/take")
var mongo = require("mongo-client")
var insert = require("mongo-client/insert")
var find = require("mongo-client/find")
+var close = require("mongo-client/close")
var passback = require("callback-reduce/passback")
var incrementalMapReduce = require("../index")
@@ -124,6 +127,21 @@ test("doesn't re-run old data", function (assert) {
})
})
+test("cleanup", function (assert) {
+ var done = after(2, function () {
+ close(rawCollection)
+ assert.end()
+ })
+
+ fold(rawCollection, function (col) {
+ col.drop(done)
+ })
+
+ fold(reducedCollection, function (col) {
+ col.drop(done)
+ })
+})
+
function map() {
/*global emit*/
emit(this.id, this)

0 comments on commit 35e8ccc

Please sign in to comment.