2014-07-11 15:07:22 +00:00
|
|
|
var async = require('async');
|
|
|
|
var loopback = require('../');
|
|
|
|
|
|
|
|
// create a unique Checkpoint model
|
2014-10-09 15:46:36 +00:00
|
|
|
var Checkpoint = loopback.Checkpoint.extend('TestCheckpoint');
|
2014-07-11 15:07:22 +00:00
|
|
|
Checkpoint.attachTo(loopback.memory());
|
|
|
|
|
|
|
|
describe('Checkpoint', function() {
|
|
|
|
describe('current()', function() {
|
|
|
|
it('returns the highest `seq` value', function(done) {
|
|
|
|
async.series([
|
|
|
|
Checkpoint.create.bind(Checkpoint),
|
|
|
|
Checkpoint.create.bind(Checkpoint),
|
|
|
|
function(next) {
|
|
|
|
Checkpoint.current(function(err, seq) {
|
|
|
|
if (err) next(err);
|
|
|
|
expect(seq).to.equal(2);
|
|
|
|
next();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
], done);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|