-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move the code to check for is_db_updates to self.check_for_catchup() Conflicts: lib/feed.js package.json
- Loading branch information
Showing
6 changed files
with
84 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
var tap = require('tap') | ||
var test = tap.test | ||
var util = require('util') | ||
|
||
var lib = require('../../lib') | ||
var couch = require('../couch') | ||
var follow = require('../../api') | ||
|
||
couch.setup(test) | ||
|
||
test('Issue #43', function(t) { | ||
var changes = 0 | ||
|
||
var feed = follow({'db':couch.DB, 'inactivity_ms':couch.rtt()*3}, on_change) | ||
feed.on('stop', on_stop) | ||
feed.on('error', on_err) | ||
|
||
function on_err(er) { | ||
t.false(er, 'Error event should never fire') | ||
t.end() | ||
} | ||
|
||
function on_change(er, change) { | ||
changes += 1 | ||
this.stop() | ||
} | ||
|
||
function on_stop(er) { | ||
t.false(er, 'No problem stopping') | ||
t.equal(changes, 1, 'Only one change seen since stop was called in its callback') | ||
t.end() | ||
} | ||
}) |