Checkpoint: start with seq=1 instead of seq=0

Since the seq behaves in many senses like an id, it should meet
the usual expectation people have about ids. Using only truthy values
is one of them.
This commit is contained in:
Miroslav Bajtoš 2015-03-03 14:53:49 +01:00
parent 628e3a30ca
commit 3d5c8a7443
2 changed files with 2 additions and 2 deletions

View File

@ -41,7 +41,7 @@ module.exports = function(Checkpoint) {
if (checkpoint) {
cb(null, checkpoint.seq);
} else {
Checkpoint.create({seq: 0}, function(err, checkpoint) {
Checkpoint.create({ seq: 1 }, function(err, checkpoint) {
if (err) return cb(err);
cb(null, checkpoint.seq);
});

View File

@ -14,7 +14,7 @@ describe('Checkpoint', function() {
function(next) {
Checkpoint.current(function(err, seq) {
if (err) next(err);
expect(seq).to.equal(2);
expect(seq).to.equal(3);
next();
});
}