Exemple #1
0
 it('should delete the given checkpoint', async () => {
   await context.initialize(true);
   const model = await context.createCheckpoint();
   context.deleteCheckpoint(model.id);
   const models = await context.listCheckpoints();
   expect(models.length).to.equal(0);
 });
 it('should create a checkpoint for the file', (done) => {
   context.createCheckpoint().then(model => {
     expect(model.id).to.be.ok();
     expect(model.last_modified).to.be.ok();
     done();
   }).catch(done);
 });
 it('should delete the given checkpoint', (done) => {
   context.createCheckpoint().then(model => {
     return context.deleteCheckpoint(model.id);
   }).then(() => {
     return context.listCheckpoints();
   }).then(models => {
     expect(models.length).to.be(0);
     done();
   }).catch(done);
 });
Exemple #4
0
 it('should restore the value to the last checkpoint value', async () => {
   context.model.fromString('bar');
   await context.initialize(true);
   const model = await context.createCheckpoint();
   context.model.fromString('foo');
   const id = model.id;
   await context.save();
   await context.restoreCheckpoint(id);
   await context.revert();
   expect(context.model.toString()).to.equal('bar');
 });
Exemple #5
0
 return context.initialize(true).then(() => {
   context.createCheckpoint().then(model => {
     id = model.id;
     return context.listCheckpoints();
   }).then(models => {
     for (let model of models) {
       if (model.id === id) {
         return;
       }
     }
     throw new Error('Model not found');
   });
 });
Exemple #6
0
 it('should list the checkpoints for the file', async () => {
   await context.initialize(true);
   const model = await context.createCheckpoint();
   const id = model.id;
   const models = await context.listCheckpoints();
   let found = false;
   for (const model of models) {
     if (model.id === id) {
       found = true;
     }
   }
   expect(found).to.equal(true);
 });
 it('should list the checkpoints for the file', (done) => {
   let id = '';
   context.createCheckpoint().then(model => {
     id = model.id;
     return context.listCheckpoints();
   }).then(models => {
     for (let model of models) {
       if (model.id === id) {
         done();
         return;
       }
     }
   }).catch(done);
 });
Exemple #8
0
 return context.initialize(true).then(() => {
   return context.createCheckpoint();
 }).then(model => {
Exemple #9
0
 return context.save().then(() => {
   return context.createCheckpoint();
 }).then(model => {
Exemple #10
0
 .then(() => {
   return context.createCheckpoint();
 })