Don't proxy version number to/from docstore
This commit is contained in:
@@ -284,9 +284,8 @@ describe 'ProjectEntityHandler', ->
|
||||
describe 'getDoc', ->
|
||||
beforeEach ->
|
||||
@lines = ["mock", "doc", "lines"]
|
||||
@version = 42
|
||||
@rev = 5
|
||||
@DocstoreManager.getDoc = sinon.stub().callsArgWith(2, null, @lines, @version, @rev)
|
||||
@DocstoreManager.getDoc = sinon.stub().callsArgWith(2, null, @lines, @rev)
|
||||
@ProjectEntityHandler.getDoc project_id, doc_id, @callback
|
||||
|
||||
it "should call the docstore", ->
|
||||
@@ -295,7 +294,7 @@ describe 'ProjectEntityHandler', ->
|
||||
.should.equal true
|
||||
|
||||
it "should call the callback with the lines, version and rev", ->
|
||||
@callback.calledWith(null, @lines, @version, @rev).should.equal true
|
||||
@callback.calledWith(null, @lines, @rev).should.equal true
|
||||
|
||||
describe 'addDoc', ->
|
||||
beforeEach ->
|
||||
@@ -465,7 +464,6 @@ describe 'ProjectEntityHandler', ->
|
||||
@doc = {
|
||||
_id: doc_id
|
||||
}
|
||||
@version = 42
|
||||
@ProjectGetter.getProjectWithoutDocLines = sinon.stub().callsArgWith(1, null, @project)
|
||||
@projectLocator.findElement = sinon.stub().callsArgWith(1, null, @doc, {fileSystem: @path})
|
||||
@tpdsUpdateSender.addDoc = sinon.stub().callsArg(1)
|
||||
@@ -474,8 +472,8 @@ describe 'ProjectEntityHandler', ->
|
||||
|
||||
describe "when the doc has been modified", ->
|
||||
beforeEach ->
|
||||
@DocstoreManager.updateDoc = sinon.stub().callsArgWith(4, null, true, @rev = 5)
|
||||
@ProjectEntityHandler.updateDocLines project_id, doc_id, @lines, @version, @callback
|
||||
@DocstoreManager.updateDoc = sinon.stub().callsArgWith(3, null, true, @rev = 5)
|
||||
@ProjectEntityHandler.updateDocLines project_id, doc_id, @lines, @callback
|
||||
|
||||
it "should get the project without doc lines", ->
|
||||
@ProjectGetter.getProjectWithoutDocLines
|
||||
@@ -493,7 +491,7 @@ describe 'ProjectEntityHandler', ->
|
||||
|
||||
it "should update the doc in the docstore", ->
|
||||
@DocstoreManager.updateDoc
|
||||
.calledWith(project_id, doc_id, @lines, @version)
|
||||
.calledWith(project_id, doc_id, @lines)
|
||||
.should.equal true
|
||||
|
||||
it "should mark the project as updated", ->
|
||||
@@ -517,8 +515,8 @@ describe 'ProjectEntityHandler', ->
|
||||
|
||||
describe "when the doc has not been modified", ->
|
||||
beforeEach ->
|
||||
@DocstoreManager.updateDoc = sinon.stub().callsArgWith(4, null, false, @rev = 5)
|
||||
@ProjectEntityHandler.updateDocLines project_id, doc_id, @lines, @version, @callback
|
||||
@DocstoreManager.updateDoc = sinon.stub().callsArgWith(3, null, false, @rev = 5)
|
||||
@ProjectEntityHandler.updateDocLines project_id, doc_id, @lines, @callback
|
||||
|
||||
it "should not mark the project as updated", ->
|
||||
@projectUpdater.markAsUpdated.called.should.equal false
|
||||
@@ -532,7 +530,7 @@ describe 'ProjectEntityHandler', ->
|
||||
describe "when the project is not found", ->
|
||||
beforeEach ->
|
||||
@ProjectGetter.getProjectWithoutDocLines = sinon.stub().callsArgWith(1, null, null)
|
||||
@ProjectEntityHandler.updateDocLines project_id, doc_id, @lines, @version, @callback
|
||||
@ProjectEntityHandler.updateDocLines project_id, doc_id, @lines, @callback
|
||||
|
||||
it "should return a not found error", ->
|
||||
@callback.calledWith(new Errors.NotFoundError()).should.equal true
|
||||
@@ -540,14 +538,13 @@ describe 'ProjectEntityHandler', ->
|
||||
describe "when the doc is not found", ->
|
||||
beforeEach ->
|
||||
@projectLocator.findElement = sinon.stub().callsArgWith(1, null, null, null)
|
||||
@ProjectEntityHandler.updateDocLines project_id, doc_id, @lines, @version, @callback
|
||||
@ProjectEntityHandler.updateDocLines project_id, doc_id, @lines, @callback
|
||||
|
||||
it "should log out the error", ->
|
||||
@logger.error
|
||||
.calledWith(
|
||||
project_id: project_id
|
||||
doc_id: doc_id
|
||||
version: @version
|
||||
lines: @lines
|
||||
err: new Errors.NotFoundError("doc not found")
|
||||
"doc not found while updating doc lines"
|
||||
|
||||
Reference in New Issue
Block a user