Exemple #1
0
 it('should revert the contents of the file to the disk', async () => {
   await context.initialize(true);
   context.model.fromString('foo');
   await context.save();
   context.model.fromString('bar');
   await context.revert();
   expect(context.model.toString()).to.equal('foo');
 });
Exemple #2
0
 it('should resolve when the file is reverted for the first time', (done) => {
   manager.contents.save(context.path, {
     type: factory.contentType,
     format: factory.fileFormat,
     content: 'foo'
   });
   context.ready.then(done, done);
   context.revert().catch(done);
 });
Exemple #3
0
 it('should normalize CRLF line endings to LF', async () => {
   await context.initialize(true);
   await manager.contents.save(context.path, {
     type: factory.contentType,
     format: factory.fileFormat,
     content: 'foo\r\nbar'
   });
   await context.revert();
   expect(context.model.toString()).to.equal('foo\nbar');
 });
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
 it('should should preserve CRLF line endings upon save', async () => {
   await context.initialize(true);
   await manager.contents.save(context.path, {
     type: factory.contentType,
     format: factory.fileFormat,
     content: 'foo\r\nbar'
   });
   await context.revert();
   await context.save();
   const opts: Contents.IFetchOptions = {
     format: factory.fileFormat,
     type: factory.contentType,
     content: true
   };
   const model = await manager.contents.get(context.path, opts);
   expect(model.content).to.equal('foo\r\nbar');
 });
Exemple #6
0
 }).then(() => {
   return context.revert();
 }).then(() => {
Exemple #7
0
 }).then(() => {
   context.model.fromString('bar');
   return context.revert();
 }).then(() => {