Skip to content

Commit 0166274

Browse files
authored
Merge pull request #602 from share/flaky-milestone-test-fix
✅ Try to fix flaky Milestone DB tests
2 parents 404cde5 + a7c7697 commit 0166274

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

test/milestone-db.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -576,8 +576,10 @@ module.exports = function(options) {
576576
});
577577

578578
it('only stores even-numbered versions', function(done) {
579-
db.on('save', function(collection, snapshot) {
580-
if (snapshot.v !== 4) return;
579+
var snapshotCount = 0;
580+
db.on('save', function() {
581+
snapshotCount++;
582+
if (snapshotCount < 2) return;
581583

582584
async.waterfall([
583585
db.getMilestoneSnapshot.bind(db, 'books', 'catcher-in-the-rye', 1),
@@ -619,8 +621,10 @@ module.exports = function(options) {
619621
callback();
620622
});
621623

622-
db.on('save', function(collection, snapshot) {
623-
if (snapshot.v !== 4) return;
624+
var snapshotCount = 0;
625+
db.on('save', function() {
626+
snapshotCount++;
627+
if (snapshotCount < 2) return;
624628

625629
async.waterfall([
626630
db.getMilestoneSnapshot.bind(db, 'books', 'catcher-in-the-rye', 1),

0 commit comments

Comments
 (0)