Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Tweaked test to clear the test2 (replication target) db before runnin…
…g tests
  • Loading branch information
Damon Oehlman committed Jul 20, 2012
1 parent 1824e90 commit b71be38
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
3 changes: 2 additions & 1 deletion lib/replimate.js
Expand Up @@ -59,6 +59,7 @@ function _watchForState(monitor, state, interval) {
monitor.checkStatus(function(err, data) {
// if we captured an error, trigger an error event
if (err) {
debug('Received error checking status: ', err);
monitor.emit('error', new Error('Error checking status while waiting for replication completion'));
clearInterval(monitorTimer);
}
Expand All @@ -72,7 +73,7 @@ function _watchForState(monitor, state, interval) {
return function(evtName) {
if (evtName === state) {
if (! monitorTimer) {
debug('done event listener detected, watching for replication completion');
debug(evtName + ' event listener detected, watching for replication completion');
monitorTimer = setInterval(checkState, interval || 1000);
}
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -28,7 +28,7 @@
"url": "http://github.com/DamonOehlman/replimate/issues"
},
"scripts": {
"test": "mocha --reporter spec -t 10000"
"test": "mocha --reporter spec -t 20000"
},
"contributors": []
}
4 changes: 4 additions & 0 deletions test/helpers/reset-test2db.js
@@ -0,0 +1,4 @@
exports.run = function(couch, callback) {
// look for the test db
couch.db.destroy('test2', callback);
};
5 changes: 3 additions & 2 deletions test/replication.js
Expand Up @@ -10,7 +10,8 @@ describe('replication', function() {
before(function(done) {
async.series([
async.apply(require('./helpers/create-testdb').run, couch),
async.apply(require('./helpers/populate-testdb').run, couch)
async.apply(require('./helpers/populate-testdb').run, couch),
async.apply(require('./helpers/reset-test2db').run, couch)
], done);
});

Expand Down Expand Up @@ -41,7 +42,7 @@ describe('replication', function() {
});
});

it('should be able to create continuos replication jobs', function(done) {
it('should be able to create continuous replication jobs', function(done) {
var opts = {
action: 'replicate',
source: 'test',
Expand Down

0 comments on commit b71be38

Please sign in to comment.