Revert "Revert "Add projectHistoryId to updates""

This commit is contained in:
Hayden Faulds
2018-04-23 12:08:04 +01:00
committed by GitHub
parent ee2b8e9a60
commit 1b63141e49
17 changed files with 160 additions and 115 deletions
@@ -509,23 +509,24 @@ describe "HttpController", ->
describe "updateProject", ->
beforeEach ->
@projectHistoryId = "history-id-123"
@userId = "user-id-123"
@docUpdates = sinon.stub()
@fileUpdates = sinon.stub()
@version = 1234567
@req =
body: {@userId, @docUpdates, @fileUpdates, @version}
body: {@projectHistoryId, @userId, @docUpdates, @fileUpdates, @version}
params:
project_id: @project_id
describe "successfully", ->
beforeEach ->
@ProjectManager.updateProjectWithLocks = sinon.stub().callsArgWith(5)
@ProjectManager.updateProjectWithLocks = sinon.stub().callsArgWith(6)
@HttpController.updateProject(@req, @res, @next)
it "should accept the change", ->
@ProjectManager.updateProjectWithLocks
.calledWith(@project_id, @userId, @docUpdates, @fileUpdates, @version)
.calledWith(@project_id, @projectHistoryId, @userId, @docUpdates, @fileUpdates, @version)
.should.equal true
it "should return a successful No Content response", ->
@@ -538,7 +539,7 @@ describe "HttpController", ->
describe "when an errors occurs", ->
beforeEach ->
@ProjectManager.updateProjectWithLocks = sinon.stub().callsArgWith(5, new Error("oops"))
@ProjectManager.updateProjectWithLocks = sinon.stub().callsArgWith(6, new Error("oops"))
@HttpController.updateProject(@req, @res, @next)
it "should call next with the error", ->
@@ -548,23 +549,24 @@ describe "HttpController", ->
describe "resyncProjectHistory", ->
beforeEach ->
@projectHistoryId = "history-id-123"
@docs = sinon.stub()
@files = sinon.stub()
@fileUpdates = sinon.stub()
@req =
body:
{@docs, @files}
{@projectHistoryId, @docs, @files}
params:
project_id: @project_id
describe "successfully", ->
beforeEach ->
@HistoryManager.resyncProjectHistory = sinon.stub().callsArg(3)
@HistoryManager.resyncProjectHistory = sinon.stub().callsArgWith(4)
@HttpController.resyncProjectHistory(@req, @res, @next)
it "should accept the change", ->
@HistoryManager.resyncProjectHistory
.calledWith(@project_id, @docs, @files)
.calledWith(@project_id, @projectHistoryId, @docs, @files)
.should.equal true
it "should return a successful No Content response", ->
@@ -574,7 +576,7 @@ describe "HttpController", ->
describe "when an errors occurs", ->
beforeEach ->
@HistoryManager.resyncProjectHistory = sinon.stub().callsArgWith(3, new Error("oops"))
@HistoryManager.resyncProjectHistory = sinon.stub().callsArgWith(4, new Error("oops"))
@HttpController.resyncProjectHistory(@req, @res, @next)
it "should call next with the error", ->