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) {
|
if (checkpoint) {
|
||||||
cb(null, checkpoint.seq);
|
cb(null, checkpoint.seq);
|
||||||
} else {
|
} else {
|
||||||
Checkpoint.create({seq: 0}, function(err, checkpoint) {
|
Checkpoint.create({ seq: 1 }, function(err, checkpoint) {
|
||||||
if (err) return cb(err);
|
if (err) return cb(err);
|
||||||
cb(null, checkpoint.seq);
|
cb(null, checkpoint.seq);
|
||||||
});
|
});
|
||||||
|
|
|
@ -14,7 +14,7 @@ describe('Checkpoint', function() {
|
||||||
function(next) {
|
function(next) {
|
||||||
Checkpoint.current(function(err, seq) {
|
Checkpoint.current(function(err, seq) {
|
||||||
if (err) next(err);
|
if (err) next(err);
|
||||||
expect(seq).to.equal(2);
|
expect(seq).to.equal(3);
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue