|
|
@@ -133,6 +133,25 @@ describe 'ProjectRootDocManager', ->
|
|
|
@ProjectEntityUpdateHandler.setRootDoc.calledWith(@project_id, "doc-id-3")
|
|
|
.should.equal true
|
|
|
|
|
|
+ describe "when there is a suitable root doc but the filename is in quotes", ->
|
|
|
+ beforeEach (done)->
|
|
|
+ @docPaths =
|
|
|
+ "doc-id-1": "/chapter1.tex"
|
|
|
+ "doc-id-2": "/main.tex"
|
|
|
+ "doc-id-3": "/nested/chapter1a.tex"
|
|
|
+ "doc-id-4": "/nested/chapter1b.tex"
|
|
|
+ @ProjectEntityHandler.getAllDocPathsFromProjectById = sinon.stub().callsArgWith(1, null, @docPaths)
|
|
|
+ @ProjectEntityUpdateHandler.setRootDoc = sinon.stub().callsArgWith(2)
|
|
|
+ @ProjectRootDocManager.setRootDocFromName @project_id, "'main.tex'", done
|
|
|
+
|
|
|
+ it "should check the docs of the project", ->
|
|
|
+ @ProjectEntityHandler.getAllDocPathsFromProjectById.calledWith(@project_id)
|
|
|
+ .should.equal true
|
|
|
+
|
|
|
+ it "should set the root doc to main.tex", ->
|
|
|
+ @ProjectEntityUpdateHandler.setRootDoc.calledWith(@project_id, "doc-id-2")
|
|
|
+ .should.equal true
|
|
|
+
|
|
|
describe "when there is no suitable root doc", ->
|
|
|
beforeEach (done)->
|
|
|
@docPaths =
|