move docupdater flush to point of use
This commit is contained in:
@@ -26,6 +26,7 @@ describe "ClsiManager", ->
|
||||
url: "https://clsipremium.example.com"
|
||||
"../../models/Project": Project: @Project = {}
|
||||
"../Project/ProjectEntityHandler": @ProjectEntityHandler = {}
|
||||
"../DocumentUpdater/DocumentUpdaterHandler": @DocumentUpdaterHandler = {}
|
||||
"./ClsiCookieManager": @ClsiCookieManager
|
||||
"logger-sharelatex": @logger = { log: sinon.stub(), error: sinon.stub(), warn: sinon.stub() }
|
||||
"request": @request = sinon.stub()
|
||||
@@ -144,6 +145,7 @@ describe "ClsiManager", ->
|
||||
@Project.findById = sinon.stub().callsArgWith(2, null, @project)
|
||||
@ProjectEntityHandler.getAllDocs = sinon.stub().callsArgWith(1, null, @docs)
|
||||
@ProjectEntityHandler.getAllFiles = sinon.stub().callsArgWith(1, null, @files)
|
||||
@DocumentUpdaterHandler.flushProjectToMongo = sinon.stub().callsArgWith(1, null)
|
||||
|
||||
describe "with a valid project", ->
|
||||
beforeEach (done) ->
|
||||
@@ -156,6 +158,11 @@ describe "ClsiManager", ->
|
||||
.calledWith(@project_id, {compiler:1, rootDoc_id: 1, imageName: 1})
|
||||
.should.equal true
|
||||
|
||||
it "should flush the project to the database", ->
|
||||
@DocumentUpdaterHandler.flushProjectToMongo
|
||||
.calledWith(@project_id)
|
||||
.should.equal true
|
||||
|
||||
it "should get all the docs", ->
|
||||
@ProjectEntityHandler.getAllDocs
|
||||
.calledWith(@project_id)
|
||||
|
||||
@@ -17,7 +17,6 @@ describe "CompileManager", ->
|
||||
redis: web: {host: "localhost", port: 42}
|
||||
"../../infrastructure/RedisWrapper":
|
||||
client: () => @rclient = { auth: () -> }
|
||||
"../DocumentUpdater/DocumentUpdaterHandler": @DocumentUpdaterHandler = {}
|
||||
"../Project/ProjectRootDocManager": @ProjectRootDocManager = {}
|
||||
"../../models/Project": Project: @Project = {}
|
||||
"../User/UserGetter": @UserGetter = {}
|
||||
@@ -40,7 +39,6 @@ describe "CompileManager", ->
|
||||
beforeEach ->
|
||||
@CompileManager._checkIfRecentlyCompiled = sinon.stub().callsArgWith(2, null, false)
|
||||
@CompileManager._ensureRootDocumentIsSet = sinon.stub().callsArgWith(1, null)
|
||||
@DocumentUpdaterHandler.flushProjectToMongo = sinon.stub().callsArgWith(1, null)
|
||||
@CompileManager.getProjectCompileLimits = sinon.stub().callsArgWith(1, null, @limits)
|
||||
@ClsiManager.sendRequest = sinon.stub().callsArgWith(3, null, @status = "mock-status", @outputFiles = "mock output files", @output = "mock output")
|
||||
|
||||
@@ -54,11 +52,6 @@ describe "CompileManager", ->
|
||||
.calledWith(@project_id, @user_id)
|
||||
.should.equal true
|
||||
|
||||
it "should flush the project to the database", ->
|
||||
@DocumentUpdaterHandler.flushProjectToMongo
|
||||
.calledWith(@project_id)
|
||||
.should.equal true
|
||||
|
||||
it "should ensure that the root document is set", ->
|
||||
@CompileManager._ensureRootDocumentIsSet
|
||||
.calledWith(@project_id)
|
||||
|
||||
Reference in New Issue
Block a user