Get project without doc lines in getAllFolders

This commit is contained in:
James Allen 2014-05-06 13:15:18 +01:00
parent 6a2370b5be
commit 2fb8b0e807
2 changed files with 9 additions and 1 deletions

View file

@ -14,6 +14,7 @@ slReqIdHelper = require('soa-req-id')
docComparitor = require('./DocLinesComparitor')
projectUpdateHandler = require('./ProjectUpdateHandler')
DocstoreManager = require "../Docstore/DocstoreManager"
ProjectGetter = require "./ProjectGetter"
module.exports = ProjectEntityHandler =
getAllFolders: (project_id, sl_req_id, callback) ->
@ -24,7 +25,7 @@ module.exports = ProjectEntityHandler =
folders[basePath] = folder
processFolder path.join(basePath, childFolder.name), childFolder for childFolder in folder.folders
Project.findById project_id, (err, project) ->
ProjectGetter.getProjectWithoutDocLines project_id, (err, project) ->
return callback(err) if err?
return callback("no project") if !project?
processFolder "/", project.rootFolder[0]

View file

@ -64,6 +64,7 @@ describe 'ProjectEntityHandler', ->
'../Docstore/DocstoreManager': @DocstoreManager = {}
'logger-sharelatex':{log:->}
'./ProjectUpdateHandler': @projectUpdater
"./ProjectGetter": @ProjectGetter = {}
describe 'mkdirp', ->
@ -507,12 +508,18 @@ describe 'ProjectEntityHandler', ->
folders : []
}]
]
@ProjectGetter.getProjectWithoutDocLines = sinon.stub().callsArgWith(1, null, @project)
describe "getAllFolders", ->
beforeEach ->
@callback = sinon.stub()
@ProjectEntityHandler.getAllFolders project_id, @callback
it "should get the project without the docs lines", ->
@ProjectGetter.getProjectWithoutDocLines
.calledWith(project_id)
.should.equal true
it "should call the callback with the folders", ->
@callback
.calledWith(null, {