| 88 | |
| 89 | describe('commit', function() { |
| 90 | function commitConcurrent(db, ops, test, done) { |
| 91 | var numSucceeded = 0; |
| 92 | async.each(ops, function(op, eachCb) { |
| 93 | submit(db, 'testcollection', 'foo', op, function(err, succeeded) { |
| 94 | if (err) return eachCb(err); |
| 95 | if (succeeded) numSucceeded++; |
| 96 | eachCb(); |
| 97 | }); |
| 98 | }, function(err) { |
| 99 | if (err) return done(err); |
| 100 | expect(numSucceeded).equal(1); |
| 101 | if (!test) return done(); |
| 102 | db.getOps('testcollection', 'foo', 0, null, null, function(err, opsOut) { |
| 103 | if (err) return done(err); |
| 104 | db.getSnapshot('testcollection', 'foo', null, null, function(err, snapshotOut) { |
| 105 | if (err) return done(err); |
| 106 | test(opsOut, snapshotOut); |
| 107 | done(); |
| 108 | }); |
| 109 | }); |
| 110 | }); |
| 111 | } |
| 112 | |
| 113 | function testCreateCommit(ops, snapshot) { |
| 114 | expect(snapshot.v).eql(1); |