Permalink
Browse files

(456) - Cleanup during test runs

  • Loading branch information...
1 parent 22b5ac1 commit 861bd19c4c888ad1490310b85bafc886fa2487ba @daleharvey daleharvey committed Mar 30, 2013
View
@@ -1,6 +1,7 @@
/*globals initTestDB: false, emit: true, generateAdapterUrl: false */
/*globals PERSIST_DATABASES: false, initDBPair: false, utils: true */
/*globals ajax: true, LevelPouch: true, makeDocs: false */
+/*globals cleanupTestDatabases: false */
"use strict";
@@ -26,12 +27,9 @@ adapters.map(function(adapter) {
qunit('all_docs: ' + adapter, {
setup : function () {
this.name = generateAdapterUrl(adapter);
+ Pouch.enableAllDbs = true;
},
- teardown: function() {
- if (!PERSIST_DATABASES) {
- Pouch.destroy(this.name);
- }
- }
+ teardown: cleanupTestDatabases
});
var origDocs = [
@@ -2,6 +2,7 @@
/*globals PERSIST_DATABASES: false, initDBPair: false, utils: true */
/*globals ajax: true, LevelPouch: true, makeDocs: false */
/*globals readBlob: false, makeBlob: false */
+/*globals cleanupTestDatabases: false */
"use strict";
@@ -30,12 +31,9 @@ adapters.map(function(adapter) {
qunit('attachments: ' + adapter, {
setup : function () {
this.name = generateAdapterUrl(adapter);
+ Pouch.enableAllDbs = true;
},
- teardown: function() {
- if (!PERSIST_DATABASES) {
- Pouch.destroy(this.name);
- }
- }
+ teardown: cleanupTestDatabases
});
var binAttDoc = {
View
@@ -1,6 +1,7 @@
/*globals initTestDB: false, emit: true, generateAdapterUrl: false */
/*globals PERSIST_DATABASES: false, initDBPair: false, utils: true */
/*globals ajax: true, LevelPouch: true */
+/*globals cleanupTestDatabases: false */
"use strict";
@@ -24,12 +25,9 @@ adapters.map(function(adapter) {
qunit("basics: " + adapter, {
setup: function() {
this.name = generateAdapterUrl(adapter);
+ Pouch.enableAllDbs = true;
},
- teardown: function() {
- if (!PERSIST_DATABASES) {
- Pouch.destroy(this.name);
- }
- }
+ teardown: cleanupTestDatabases
});
asyncTest("Create a pouch", 1, function() {
@@ -60,7 +58,6 @@ adapters.map(function(adapter) {
});
asyncTest("Modify a doc", 3, function() {
- console.info('testing: Modify a doc');
initTestDB(this.name, function(err, db) {
ok(!err, 'opened the pouch');
db.post({test: "somestuff"}, function (err, info) {
View
@@ -1,6 +1,7 @@
/*globals initTestDB: false, emit: true, generateAdapterUrl: false */
/*globals PERSIST_DATABASES: false, initDBPair: false, utils: true */
/*globals ajax: true, LevelPouch: true, makeDocs: false */
+/*globals cleanupTestDatabases: false */
"use strict";
@@ -27,12 +28,9 @@ adapters.map(function(adapter) {
qunit('bulk_docs: ' + adapter, {
setup : function () {
this.name = generateAdapterUrl(adapter);
+ Pouch.enableAllDbs = true;
},
- teardown: function() {
- if (!PERSIST_DATABASES) {
- Pouch.destroy(this.name);
- }
- }
+ teardown: cleanupTestDatabases
});
var authors = [
View
@@ -1,6 +1,7 @@
/*globals initTestDB: false, emit: true, generateAdapterUrl: false */
/*globals PERSIST_DATABASES: false, initDBPair: false, utils: true */
/*globals ajax: true, LevelPouch: true */
+/*globals cleanupTestDatabases: false */
"use strict";
@@ -26,12 +27,9 @@ adapters.map(function(adapter) {
QUnit.module("changes: " + adapter, {
setup : function () {
this.name = generateAdapterUrl(adapter);
+ Pouch.enableAllDbs = true;
},
- teardown: function() {
- if (!PERSIST_DATABASES) {
- Pouch.destroy(this.name);
- }
- }
+ teardown: cleanupTestDatabases
});
asyncTest("All changes", function () {
View
@@ -1,6 +1,7 @@
/*globals initTestDB: false, emit: true, generateAdapterUrl: false */
/*globals PERSIST_DATABASES: false, initDBPair: false, utils: true, putTree: false */
/*globals ajax: true, LevelPouch: true, makeDocs: false */
+/*globals cleanupTestDatabases: false */
"use strict";
@@ -25,12 +26,9 @@ adapters.map(function(adapter) {
qunit('compaction: ' + adapter, {
setup : function () {
this.name = generateAdapterUrl(adapter);
+ Pouch.enableAllDbs = true;
},
- teardown: function() {
- if (!PERSIST_DATABASES) {
- Pouch.destroy(this.name);
- }
- }
+ teardown: cleanupTestDatabases
});
asyncTest('Compation document with no revisions to remove', function() {
View
@@ -1,6 +1,7 @@
/*globals initTestDB: false, emit: true, generateAdapterUrl: false */
/*globals PERSIST_DATABASES: false, initDBPair: false, utils: true */
/*globals ajax: true, LevelPouch: true */
+/*globals cleanupTestDatabases: false */
"use strict";
@@ -26,12 +27,9 @@ adapters.map(function(adapter) {
qunit('conflicts: ' + adapter, {
setup : function () {
this.name = generateAdapterUrl(adapter);
+ Pouch.enableAllDbs = true;
},
- teardown: function() {
- if (!PERSIST_DATABASES) {
- Pouch.destroy(this.name);
- }
- }
+ teardown: cleanupTestDatabases
});
asyncTest('Testing conflicts', function() {
@@ -1,6 +1,7 @@
/*globals initTestDB: false, emit: true, generateAdapterUrl: false */
/*globals PERSIST_DATABASES: false, initDBPair: false, utils: true */
/*globals ajax: true, LevelPouch: true */
+/*globals cleanupTestDatabases: false */
"use strict";
@@ -26,12 +27,9 @@ adapters.map(function(adapter) {
qunit("design_docs: " + adapter, {
setup : function () {
this.name = generateAdapterUrl(adapter);
+ Pouch.enableAllDbs = true;
},
- teardown: function() {
- if (!PERSIST_DATABASES) {
- Pouch.destroy(this.name);
- }
- }
+ teardown: cleanupTestDatabases
});
var doc = {
View
@@ -1,6 +1,7 @@
/*globals initTestDB: false, emit: true, generateAdapterUrl: false, putTree: false, putBranch: false */
/*globals PERSIST_DATABASES: false, initDBPair: false, utils: true */
/*globals ajax: true, LevelPouch: true, makeDocs: false, strictEqual: false, notStrictEqual: false */
+/*globals cleanupTestDatabases: false */
"use strict";
@@ -26,12 +27,9 @@ adapters.map(function(adapter) {
qunit('get: ' + adapter, {
setup : function () {
this.name = generateAdapterUrl(adapter);
+ Pouch.enableAllDbs = true;
},
- teardown: function() {
- if (!PERSIST_DATABASES) {
- Pouch.destroy(this.name);
- }
- }
+ teardown: cleanupTestDatabases
});
var origDocs = [
View
@@ -1,5 +1,6 @@
/*globals initTestDB: false, emit: true, generateAdapterUrl: false */
/*globals PERSIST_DATABASES: false */
+/*globals cleanupTestDatabases: false */
"use strict";
@@ -23,12 +24,9 @@ adapters.map(function(adapter) {
qunit('gql: ' + adapter, {
setup : function () {
this.name = generateAdapterUrl(adapter);
+ Pouch.enableAllDbs = true;
},
- teardown: function() {
- if (!PERSIST_DATABASES) {
- Pouch.destroy(this.name);
- }
- }
+ teardown: cleanupTestDatabases
});
asyncTest("Test select *", function() {
View
@@ -1,6 +1,7 @@
/*globals initTestDB: false, emit: true, generateAdapterUrl: false, strictEqual: false */
/*globals PERSIST_DATABASES: false, initDBPair: false, utils: true */
/*globals ajax: true, LevelPouch: true */
+/*globals cleanupTestDatabases: false */
"use strict";
@@ -30,13 +31,9 @@ adapters.map(function(adapters) {
setup: function() {
this.local = generateAdapterUrl(adapters[0]);
this.remote = generateAdapterUrl(adapters[1]);
+ Pouch.enableAllDbs = true;
},
- teardown: function() {
- if (!PERSIST_DATABASES) {
- Pouch.destroy(this.local);
- Pouch.destroy(this.remote);
- }
- }
+ teardown: cleanupTestDatabases
});
var doc = { _id: '0', integer: 0 };
@@ -1,5 +1,6 @@
/*globals initTestDB: false, emit: true, generateAdapterUrl: false */
/*globals PERSIST_DATABASES: false, initDBPair: false, openTestDB: false, putAfter: false */
+/*globals cleanupTestDatabases: false */
"use strict";
@@ -33,13 +34,9 @@ adapters.map(function(adapters) {
setup : function () {
this.name = generateAdapterUrl(adapters[0]);
this.remote = generateAdapterUrl(adapters[1]);
+ Pouch.enableAllDbs = true;
},
- teardown: function() {
- if (!PERSIST_DATABASES) {
- Pouch.destroy(this.name);
- Pouch.destroy(this.remote);
- }
- }
+ teardown: cleanupTestDatabases
});
var docs = [
View
@@ -1,10 +1,12 @@
/*globals initTestDB: false, emit: true, generateAdapterUrl: false */
/*globals PERSIST_DATABASES: false */
+/*globals cleanupTestDatabases: false */
"use strict";
var adapters = ['http-1', 'local-1'];
var qunit = module;
+var LevelPouch;
// if we are running under node.js, set things up
// a little differently, and only test the leveldb adapter
@@ -24,12 +26,9 @@ adapters.map(function(adapter) {
qunit("revs diff:" + adapter, {
setup : function () {
this.name = generateAdapterUrl(adapter);
+ Pouch.enableAllDbs = true;
},
- teardown: function() {
- if (!PERSIST_DATABASES) {
- Pouch.destroy(this.name);
- }
- }
+ teardown: cleanupTestDatabases
});
asyncTest("Test revs diff", function() {
View
@@ -1,10 +1,12 @@
/*globals initTestDB: false, emit: true, generateAdapterUrl: false */
/*globals PERSIST_DATABASES: false, Spatial: false */
+/*globals cleanupTestDatabases: false */
"use strict";
var adapters = ['local-1', 'http-1'];
var qunit = module;
+var LevelPouch;
// if we are running under node.js, set things up
// a little differently, and only test the leveldb adapter
@@ -24,12 +26,9 @@ adapters.map(function(adapter) {
qunit('spatial: ' + adapter, {
setup : function () {
this.name = generateAdapterUrl(adapter);
+ Pouch.enableAllDbs = true;
},
- teardown: function() {
- if (!PERSIST_DATABASES) {
- Pouch.destroy(this.name);
- }
- }
+ teardown: cleanupTestDatabases
});
// some geometries are based on the GeoJSON specification
View
@@ -2,6 +2,7 @@
/*globals PERSIST_DATABASES: false, initDBPair: false, utils: true */
/*globals ajax: true, LevelPouch: true */
/*globals Pouch: true, QUnit, uuid, asyncTest, ok, start*/
+/*globals cleanupTestDatabases: false */
"use strict";
@@ -24,13 +25,9 @@ adapters.map(function(adapter) {
qunit("taskqueue: " + adapter, {
setup: function() {
this.name = generateAdapterUrl(adapter);
- Pouch.destroy(this.name);
+ Pouch.enableAllDbs = true;
},
- teardown: function() {
- if (!PERSIST_DATABASES) {
- Pouch.destroy(this.name);
- }
- }
+ teardown: cleanupTestDatabases
});
asyncTest("Add a doc", 1, function() {
Oops, something went wrong.

0 comments on commit 861bd19

Please sign in to comment.