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:
parent
628e3a30ca
commit
3d5c8a7443
|
@ -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);
|
||||
});
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue