|
@@ -1,17 +1,3 @@
|
|
|
-/* eslint-disable
|
|
|
|
|
- mocha/no-nested-tests,
|
|
|
|
|
- no-return-assign,
|
|
|
|
|
- no-undef,
|
|
|
|
|
- no-unused-vars,
|
|
|
|
|
-*/
|
|
|
|
|
-// TODO: This file was created by bulk-decaffeinate.
|
|
|
|
|
-// Fix any style issues and re-enable lint.
|
|
|
|
|
-/*
|
|
|
|
|
- * decaffeinate suggestions:
|
|
|
|
|
- * DS102: Remove unnecessary code created because of implicit returns
|
|
|
|
|
- * DS207: Consider shorter variations of null checks
|
|
|
|
|
- * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
|
|
|
|
- */
|
|
|
|
|
import sinon from 'sinon'
|
|
import sinon from 'sinon'
|
|
|
import { expect } from 'chai'
|
|
import { expect } from 'chai'
|
|
|
import { strict as esmock } from 'esmock'
|
|
import { strict as esmock } from 'esmock'
|
|
@@ -53,7 +39,11 @@ describe('UpdatesProcessor', function () {
|
|
|
}
|
|
}
|
|
|
this.ErrorRecorder = {
|
|
this.ErrorRecorder = {
|
|
|
getLastFailure: sinon.stub(),
|
|
getLastFailure: sinon.stub(),
|
|
|
- record: sinon.stub().yields(),
|
|
|
|
|
|
|
+ record: sinon.stub().yields(null, { attempts: 1 }),
|
|
|
|
|
+ }
|
|
|
|
|
+ this.RetryManager = {
|
|
|
|
|
+ isFirstFailure: sinon.stub().returns(true),
|
|
|
|
|
+ isHardFailure: sinon.stub().returns(false),
|
|
|
}
|
|
}
|
|
|
this.Profiler = {
|
|
this.Profiler = {
|
|
|
Profiler: class {
|
|
Profiler: class {
|
|
@@ -101,6 +91,7 @@ describe('UpdatesProcessor', function () {
|
|
|
'../../../../app/js/SyncManager.js': this.SyncManager,
|
|
'../../../../app/js/SyncManager.js': this.SyncManager,
|
|
|
'../../../../app/js/ErrorRecorder.js': this.ErrorRecorder,
|
|
'../../../../app/js/ErrorRecorder.js': this.ErrorRecorder,
|
|
|
'../../../../app/js/Profiler.js': this.Profiler,
|
|
'../../../../app/js/Profiler.js': this.Profiler,
|
|
|
|
|
+ '../../../../app/js/RetryManager.js': this.RetryManager,
|
|
|
'../../../../app/js/Errors.js': Errors,
|
|
'../../../../app/js/Errors.js': Errors,
|
|
|
'@overleaf/metrics': this.Metrics,
|
|
'@overleaf/metrics': this.Metrics,
|
|
|
'@overleaf/settings': this.Settings,
|
|
'@overleaf/settings': this.Settings,
|
|
@@ -109,7 +100,7 @@ describe('UpdatesProcessor', function () {
|
|
|
this.project_id = 'project-id-123'
|
|
this.project_id = 'project-id-123'
|
|
|
this.ol_project_id = 'ol-project-id-234'
|
|
this.ol_project_id = 'ol-project-id-234'
|
|
|
this.callback = sinon.stub()
|
|
this.callback = sinon.stub()
|
|
|
- return (this.temporary = 'temp-mock')
|
|
|
|
|
|
|
+ this.temporary = 'temp-mock'
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
describe('processUpdatesForProject', function () {
|
|
describe('processUpdatesForProject', function () {
|
|
@@ -124,20 +115,20 @@ describe('UpdatesProcessor', function () {
|
|
|
describe('when there is no existing error', function () {
|
|
describe('when there is no existing error', function () {
|
|
|
beforeEach(function (done) {
|
|
beforeEach(function (done) {
|
|
|
this.ErrorRecorder.getLastFailure.yields()
|
|
this.ErrorRecorder.getLastFailure.yields()
|
|
|
- return this.UpdatesProcessor.processUpdatesForProject(
|
|
|
|
|
- this.project_id,
|
|
|
|
|
- done
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ this.UpdatesProcessor.processUpdatesForProject(this.project_id, err => {
|
|
|
|
|
+ expect(err).to.equal(this.error)
|
|
|
|
|
+ done()
|
|
|
|
|
+ })
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('processes updates', function () {
|
|
it('processes updates', function () {
|
|
|
- return this.UpdatesProcessor._mocks._countAndProcessUpdates
|
|
|
|
|
|
|
+ this.UpdatesProcessor._mocks._countAndProcessUpdates
|
|
|
.calledWith(this.project_id)
|
|
.calledWith(this.project_id)
|
|
|
.should.equal(true)
|
|
.should.equal(true)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- return it('records errors', function () {
|
|
|
|
|
- return this.ErrorRecorder.record
|
|
|
|
|
|
|
+ it('records errors', function () {
|
|
|
|
|
+ this.ErrorRecorder.record
|
|
|
.calledWith(this.project_id, this.queueSize, this.error)
|
|
.calledWith(this.project_id, this.queueSize, this.error)
|
|
|
.should.equal(true)
|
|
.should.equal(true)
|
|
|
})
|
|
})
|
|
@@ -154,14 +145,14 @@ describe('UpdatesProcessor', function () {
|
|
|
this.WebApiManager.getHistoryId.yields(null)
|
|
this.WebApiManager.getHistoryId.yields(null)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- return it('returns null', function (done) {
|
|
|
|
|
- return this.UpdatesProcessor._getHistoryId(
|
|
|
|
|
|
|
+ it('returns null', function (done) {
|
|
|
|
|
+ this.UpdatesProcessor._getHistoryId(
|
|
|
this.project_id,
|
|
this.project_id,
|
|
|
this.updates,
|
|
this.updates,
|
|
|
(error, projectHistoryId) => {
|
|
(error, projectHistoryId) => {
|
|
|
expect(error).to.be.null
|
|
expect(error).to.be.null
|
|
|
expect(projectHistoryId).to.be.null
|
|
expect(projectHistoryId).to.be.null
|
|
|
- return done()
|
|
|
|
|
|
|
+ done()
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
@@ -169,102 +160,102 @@ describe('UpdatesProcessor', function () {
|
|
|
|
|
|
|
|
describe('projectHistoryId is not present in updates', function () {
|
|
describe('projectHistoryId is not present in updates', function () {
|
|
|
beforeEach(function () {
|
|
beforeEach(function () {
|
|
|
- return (this.updates = [
|
|
|
|
|
|
|
+ this.updates = [
|
|
|
{ p: 0, i: 'a' },
|
|
{ p: 0, i: 'a' },
|
|
|
{ p: 1, i: 's' },
|
|
{ p: 1, i: 's' },
|
|
|
- ])
|
|
|
|
|
|
|
+ ]
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('returns the id from web', function (done) {
|
|
it('returns the id from web', function (done) {
|
|
|
this.projectHistoryId = '1234'
|
|
this.projectHistoryId = '1234'
|
|
|
this.WebApiManager.getHistoryId.yields(null, this.projectHistoryId)
|
|
this.WebApiManager.getHistoryId.yields(null, this.projectHistoryId)
|
|
|
|
|
|
|
|
- return this.UpdatesProcessor._getHistoryId(
|
|
|
|
|
|
|
+ this.UpdatesProcessor._getHistoryId(
|
|
|
this.project_id,
|
|
this.project_id,
|
|
|
this.updates,
|
|
this.updates,
|
|
|
(error, projectHistoryId) => {
|
|
(error, projectHistoryId) => {
|
|
|
expect(error).to.be.null
|
|
expect(error).to.be.null
|
|
|
expect(projectHistoryId).equal(this.projectHistoryId)
|
|
expect(projectHistoryId).equal(this.projectHistoryId)
|
|
|
- return done()
|
|
|
|
|
|
|
+ done()
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- return it('returns errors from web', function (done) {
|
|
|
|
|
|
|
+ it('returns errors from web', function (done) {
|
|
|
this.error = new Error('oh no!')
|
|
this.error = new Error('oh no!')
|
|
|
this.WebApiManager.getHistoryId.yields(this.error)
|
|
this.WebApiManager.getHistoryId.yields(this.error)
|
|
|
|
|
|
|
|
- return this.UpdatesProcessor._getHistoryId(
|
|
|
|
|
|
|
+ this.UpdatesProcessor._getHistoryId(
|
|
|
this.project_id,
|
|
this.project_id,
|
|
|
this.updates,
|
|
this.updates,
|
|
|
error => {
|
|
error => {
|
|
|
expect(error).to.equal(this.error)
|
|
expect(error).to.equal(this.error)
|
|
|
- return done()
|
|
|
|
|
|
|
+ done()
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- return describe('projectHistoryId is present in some updates', function () {
|
|
|
|
|
|
|
+ describe('projectHistoryId is present in some updates', function () {
|
|
|
beforeEach(function () {
|
|
beforeEach(function () {
|
|
|
this.projectHistoryId = '1234'
|
|
this.projectHistoryId = '1234'
|
|
|
- return (this.updates = [
|
|
|
|
|
|
|
+ this.updates = [
|
|
|
{ p: 0, i: 'a' },
|
|
{ p: 0, i: 'a' },
|
|
|
{ p: 1, i: 's', projectHistoryId: this.projectHistoryId },
|
|
{ p: 1, i: 's', projectHistoryId: this.projectHistoryId },
|
|
|
{ p: 2, i: 'd', projectHistoryId: this.projectHistoryId },
|
|
{ p: 2, i: 'd', projectHistoryId: this.projectHistoryId },
|
|
|
- ])
|
|
|
|
|
|
|
+ ]
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('returns an error if the id is inconsistent between updates', function (done) {
|
|
it('returns an error if the id is inconsistent between updates', function (done) {
|
|
|
this.updates[1].projectHistoryId = 2345
|
|
this.updates[1].projectHistoryId = 2345
|
|
|
- return this.UpdatesProcessor._getHistoryId(
|
|
|
|
|
|
|
+ this.UpdatesProcessor._getHistoryId(
|
|
|
this.project_id,
|
|
this.project_id,
|
|
|
this.updates,
|
|
this.updates,
|
|
|
error => {
|
|
error => {
|
|
|
expect(error.message).to.equal(
|
|
expect(error.message).to.equal(
|
|
|
'inconsistent project history id between updates'
|
|
'inconsistent project history id between updates'
|
|
|
)
|
|
)
|
|
|
- return done()
|
|
|
|
|
|
|
+ done()
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('returns an error if the id is inconsistent between updates and web', function (done) {
|
|
it('returns an error if the id is inconsistent between updates and web', function (done) {
|
|
|
this.WebApiManager.getHistoryId.yields(null, 2345)
|
|
this.WebApiManager.getHistoryId.yields(null, 2345)
|
|
|
- return this.UpdatesProcessor._getHistoryId(
|
|
|
|
|
|
|
+ this.UpdatesProcessor._getHistoryId(
|
|
|
this.project_id,
|
|
this.project_id,
|
|
|
this.updates,
|
|
this.updates,
|
|
|
error => {
|
|
error => {
|
|
|
expect(error.message).to.equal(
|
|
expect(error.message).to.equal(
|
|
|
'inconsistent project history id between updates and web'
|
|
'inconsistent project history id between updates and web'
|
|
|
)
|
|
)
|
|
|
- return done()
|
|
|
|
|
|
|
+ done()
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('returns the id if it is consistent between updates and web', function (done) {
|
|
it('returns the id if it is consistent between updates and web', function (done) {
|
|
|
this.WebApiManager.getHistoryId.yields(null, this.projectHistoryId)
|
|
this.WebApiManager.getHistoryId.yields(null, this.projectHistoryId)
|
|
|
- return this.UpdatesProcessor._getHistoryId(
|
|
|
|
|
|
|
+ this.UpdatesProcessor._getHistoryId(
|
|
|
this.project_id,
|
|
this.project_id,
|
|
|
this.updates,
|
|
this.updates,
|
|
|
(error, projectHistoryId) => {
|
|
(error, projectHistoryId) => {
|
|
|
expect(error).to.be.null
|
|
expect(error).to.be.null
|
|
|
expect(projectHistoryId).equal(this.projectHistoryId)
|
|
expect(projectHistoryId).equal(this.projectHistoryId)
|
|
|
- return done()
|
|
|
|
|
|
|
+ done()
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- return it('returns the id if it is consistent between updates but unavaiable in web', function (done) {
|
|
|
|
|
|
|
+ it('returns the id if it is consistent between updates but unavaiable in web', function (done) {
|
|
|
this.WebApiManager.getHistoryId.yields(new Error('oh no!'))
|
|
this.WebApiManager.getHistoryId.yields(new Error('oh no!'))
|
|
|
- return this.UpdatesProcessor._getHistoryId(
|
|
|
|
|
|
|
+ this.UpdatesProcessor._getHistoryId(
|
|
|
this.project_id,
|
|
this.project_id,
|
|
|
this.updates,
|
|
this.updates,
|
|
|
(error, projectHistoryId) => {
|
|
(error, projectHistoryId) => {
|
|
|
expect(error).to.be.null
|
|
expect(error).to.be.null
|
|
|
expect(projectHistoryId).equal(this.projectHistoryId)
|
|
expect(projectHistoryId).equal(this.projectHistoryId)
|
|
|
- return done()
|
|
|
|
|
|
|
+ done()
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
@@ -332,21 +323,21 @@ describe('UpdatesProcessor', function () {
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('should get the latest version id', function () {
|
|
it('should get the latest version id', function () {
|
|
|
- return this.HistoryStoreManager.getMostRecentVersion.should.have.been.calledWith(
|
|
|
|
|
|
|
+ this.HistoryStoreManager.getMostRecentVersion.should.have.been.calledWith(
|
|
|
this.project_id,
|
|
this.project_id,
|
|
|
this.ol_project_id
|
|
this.ol_project_id
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('should skip updates when resyncing', function () {
|
|
it('should skip updates when resyncing', function () {
|
|
|
- return this.SyncManager.skipUpdatesDuringSync.should.have.been.calledWith(
|
|
|
|
|
|
|
+ this.SyncManager.skipUpdatesDuringSync.should.have.been.calledWith(
|
|
|
this.project_id,
|
|
this.project_id,
|
|
|
this.rawUpdates
|
|
this.rawUpdates
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('should expand sync updates', function () {
|
|
it('should expand sync updates', function () {
|
|
|
- return this.SyncManager.expandSyncUpdates.should.have.been.calledWith(
|
|
|
|
|
|
|
+ this.SyncManager.expandSyncUpdates.should.have.been.calledWith(
|
|
|
this.project_id,
|
|
this.project_id,
|
|
|
this.ol_project_id,
|
|
this.ol_project_id,
|
|
|
this.mostRecentChunk,
|
|
this.mostRecentChunk,
|
|
@@ -356,13 +347,13 @@ describe('UpdatesProcessor', function () {
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('should compress updates', function () {
|
|
it('should compress updates', function () {
|
|
|
- return this.UpdateCompressor.compressRawUpdates.should.have.been.calledWith(
|
|
|
|
|
|
|
+ this.UpdateCompressor.compressRawUpdates.should.have.been.calledWith(
|
|
|
this.expandedUpdates
|
|
this.expandedUpdates
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('should create any blobs for the updates', function () {
|
|
it('should create any blobs for the updates', function () {
|
|
|
- return this.BlobManager.createBlobsForUpdates.should.have.been.calledWith(
|
|
|
|
|
|
|
+ this.BlobManager.createBlobsForUpdates.should.have.been.calledWith(
|
|
|
this.project_id,
|
|
this.project_id,
|
|
|
this.ol_project_id,
|
|
this.ol_project_id,
|
|
|
this.compressedUpdates
|
|
this.compressedUpdates
|
|
@@ -370,14 +361,14 @@ describe('UpdatesProcessor', function () {
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('should convert the updates into a change requests', function () {
|
|
it('should convert the updates into a change requests', function () {
|
|
|
- return this.UpdateTranslator.convertToChanges.should.have.been.calledWith(
|
|
|
|
|
|
|
+ this.UpdateTranslator.convertToChanges.should.have.been.calledWith(
|
|
|
this.project_id,
|
|
this.project_id,
|
|
|
this.updatesWithBlobs
|
|
this.updatesWithBlobs
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('should send the change request to the history store', function () {
|
|
it('should send the change request to the history store', function () {
|
|
|
- return this.HistoryStoreManager.sendChanges.should.have.been.calledWith(
|
|
|
|
|
|
|
+ this.HistoryStoreManager.sendChanges.should.have.been.calledWith(
|
|
|
this.project_id,
|
|
this.project_id,
|
|
|
this.ol_project_id,
|
|
this.ol_project_id,
|
|
|
['change']
|
|
['change']
|
|
@@ -385,14 +376,14 @@ describe('UpdatesProcessor', function () {
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('should set the sync state', function () {
|
|
it('should set the sync state', function () {
|
|
|
- return this.SyncManager.setResyncState.should.have.been.calledWith(
|
|
|
|
|
|
|
+ this.SyncManager.setResyncState.should.have.been.calledWith(
|
|
|
this.project_id,
|
|
this.project_id,
|
|
|
this.newSyncState
|
|
this.newSyncState
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('should call the callback with no error', function () {
|
|
it('should call the callback with no error', function () {
|
|
|
- return this.callback.should.have.been.called
|
|
|
|
|
|
|
+ this.callback.should.have.been.called
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
|
|
|
|
@@ -420,7 +411,7 @@ describe('UpdatesProcessor', function () {
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- return describe('_skipAlreadyAppliedUpdates', function () {
|
|
|
|
|
|
|
+ describe('_skipAlreadyAppliedUpdates', function () {
|
|
|
before(function () {
|
|
before(function () {
|
|
|
this.UpdateTranslator.isProjectStructureUpdate.callsFake(
|
|
this.UpdateTranslator.isProjectStructureUpdate.callsFake(
|
|
|
update => update.version != null
|
|
update => update.version != null
|
|
@@ -436,16 +427,15 @@ describe('UpdatesProcessor', function () {
|
|
|
{ doc: 'id', v: 3 },
|
|
{ doc: 'id', v: 3 },
|
|
|
{ doc: 'id', v: 4 },
|
|
{ doc: 'id', v: 4 },
|
|
|
]
|
|
]
|
|
|
- return (this.updatesToApply =
|
|
|
|
|
- this.UpdatesProcessor._skipAlreadyAppliedUpdates(
|
|
|
|
|
- this.project_id,
|
|
|
|
|
- this.updates,
|
|
|
|
|
- { docs: {} }
|
|
|
|
|
- ))
|
|
|
|
|
|
|
+ this.updatesToApply = this.UpdatesProcessor._skipAlreadyAppliedUpdates(
|
|
|
|
|
+ this.project_id,
|
|
|
|
|
+ this.updates,
|
|
|
|
|
+ { docs: {} }
|
|
|
|
|
+ )
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- return it('should return the original updates', function () {
|
|
|
|
|
- return expect(this.updatesToApply).to.eql(this.updates)
|
|
|
|
|
|
|
+ it('should return the original updates', function () {
|
|
|
|
|
+ expect(this.updatesToApply).to.eql(this.updates)
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
|
|
|
|
@@ -457,16 +447,15 @@ describe('UpdatesProcessor', function () {
|
|
|
{ version: 3 },
|
|
{ version: 3 },
|
|
|
{ version: 4 },
|
|
{ version: 4 },
|
|
|
]
|
|
]
|
|
|
- return (this.updatesToApply =
|
|
|
|
|
- this.UpdatesProcessor._skipAlreadyAppliedUpdates(
|
|
|
|
|
- this.project_id,
|
|
|
|
|
- this.updates,
|
|
|
|
|
- { docs: {} }
|
|
|
|
|
- ))
|
|
|
|
|
|
|
+ this.updatesToApply = this.UpdatesProcessor._skipAlreadyAppliedUpdates(
|
|
|
|
|
+ this.project_id,
|
|
|
|
|
+ this.updates,
|
|
|
|
|
+ { docs: {} }
|
|
|
|
|
+ )
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- return it('should return the original updates', function () {
|
|
|
|
|
- return expect(this.updatesToApply).to.eql(this.updates)
|
|
|
|
|
|
|
+ it('should return the original updates', function () {
|
|
|
|
|
+ expect(this.updatesToApply).to.eql(this.updates)
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
|
|
|
|
@@ -486,16 +475,15 @@ describe('UpdatesProcessor', function () {
|
|
|
{ version: 3 },
|
|
{ version: 3 },
|
|
|
{ version: 4 },
|
|
{ version: 4 },
|
|
|
]
|
|
]
|
|
|
- return (this.updatesToApply =
|
|
|
|
|
- this.UpdatesProcessor._skipAlreadyAppliedUpdates(
|
|
|
|
|
- this.project_id,
|
|
|
|
|
- this.updates,
|
|
|
|
|
- { docs: {} }
|
|
|
|
|
- ))
|
|
|
|
|
|
|
+ this.updatesToApply = this.UpdatesProcessor._skipAlreadyAppliedUpdates(
|
|
|
|
|
+ this.project_id,
|
|
|
|
|
+ this.updates,
|
|
|
|
|
+ { docs: {} }
|
|
|
|
|
+ )
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- return it('should return the original updates', function () {
|
|
|
|
|
- return expect(this.updatesToApply).to.eql(this.updates)
|
|
|
|
|
|
|
+ it('should return the original updates', function () {
|
|
|
|
|
+ expect(this.updatesToApply).to.eql(this.updates)
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
|
|
|
|
@@ -512,25 +500,25 @@ describe('UpdatesProcessor', function () {
|
|
|
'_skipAlreadyAppliedUpdates'
|
|
'_skipAlreadyAppliedUpdates'
|
|
|
)
|
|
)
|
|
|
try {
|
|
try {
|
|
|
- return (this.updatesToApply =
|
|
|
|
|
|
|
+ this.updatesToApply =
|
|
|
this.UpdatesProcessor._skipAlreadyAppliedUpdates(
|
|
this.UpdatesProcessor._skipAlreadyAppliedUpdates(
|
|
|
this.project_id,
|
|
this.project_id,
|
|
|
this.updates,
|
|
this.updates,
|
|
|
{ docs: {} }
|
|
{ docs: {} }
|
|
|
- ))
|
|
|
|
|
|
|
+ )
|
|
|
} catch (error) {}
|
|
} catch (error) {}
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
after(function () {
|
|
after(function () {
|
|
|
- return this.skipFn.restore()
|
|
|
|
|
|
|
+ this.skipFn.restore()
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- return it('should throw an exception', function () {
|
|
|
|
|
- return this.skipFn.threw('OpsOutOfOrderError').should.equal(true)
|
|
|
|
|
|
|
+ it('should throw an exception', function () {
|
|
|
|
|
+ this.skipFn.threw('OpsOutOfOrderError').should.equal(true)
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- return describe('with project ops out of order', function () {
|
|
|
|
|
|
|
+ describe('with project ops out of order', function () {
|
|
|
before(function () {
|
|
before(function () {
|
|
|
this.updates = [
|
|
this.updates = [
|
|
|
{ version: 1 },
|
|
{ version: 1 },
|
|
@@ -543,21 +531,21 @@ describe('UpdatesProcessor', function () {
|
|
|
'_skipAlreadyAppliedUpdates'
|
|
'_skipAlreadyAppliedUpdates'
|
|
|
)
|
|
)
|
|
|
try {
|
|
try {
|
|
|
- return (this.updatesToApply =
|
|
|
|
|
|
|
+ this.updatesToApply =
|
|
|
this.UpdatesProcessor._skipAlreadyAppliedUpdates(
|
|
this.UpdatesProcessor._skipAlreadyAppliedUpdates(
|
|
|
this.project_id,
|
|
this.project_id,
|
|
|
this.updates,
|
|
this.updates,
|
|
|
{ docs: {} }
|
|
{ docs: {} }
|
|
|
- ))
|
|
|
|
|
|
|
+ )
|
|
|
} catch (error) {}
|
|
} catch (error) {}
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
after(function () {
|
|
after(function () {
|
|
|
- return this.skipFn.restore()
|
|
|
|
|
|
|
+ this.skipFn.restore()
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- return it('should throw an exception', function () {
|
|
|
|
|
- return this.skipFn.threw('OpsOutOfOrderError').should.equal(true)
|
|
|
|
|
|
|
+ it('should throw an exception', function () {
|
|
|
|
|
+ this.skipFn.threw('OpsOutOfOrderError').should.equal(true)
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|