fix tests to allow for build parameter

This commit is contained in:
Brian Gough
2015-02-26 15:30:57 +00:00
parent 151ea99639
commit e7ed8d786a
2 changed files with 16 additions and 1 deletions

View File

@@ -36,9 +36,11 @@ describe "CompileController", ->
@output_files = [{ @output_files = [{
path: "output.pdf" path: "output.pdf"
type: "pdf" type: "pdf"
build: 1234
}, { }, {
path: "output.log" path: "output.log"
type: "log" type: "log"
build: 1234
}] }]
@RequestParser.parse = sinon.stub().callsArgWith(1, null, @request) @RequestParser.parse = sinon.stub().callsArgWith(1, null, @request)
@ProjectPersistenceManager.markProjectAsJustAccessed = sinon.stub().callsArg(1) @ProjectPersistenceManager.markProjectAsJustAccessed = sinon.stub().callsArg(1)
@@ -73,6 +75,7 @@ describe "CompileController", ->
outputFiles: @output_files.map (file) => outputFiles: @output_files.map (file) =>
url: "#{@Settings.apis.clsi.url}/project/#{@project_id}/output/#{file.path}" url: "#{@Settings.apis.clsi.url}/project/#{@project_id}/output/#{file.path}"
type: file.type type: file.type
build: file.build
) )
.should.equal true .should.equal true

View File

@@ -12,6 +12,7 @@ describe "CompileManager", ->
"./LatexRunner": @LatexRunner = {} "./LatexRunner": @LatexRunner = {}
"./ResourceWriter": @ResourceWriter = {} "./ResourceWriter": @ResourceWriter = {}
"./OutputFileFinder": @OutputFileFinder = {} "./OutputFileFinder": @OutputFileFinder = {}
"./OutputCacheManager": @OutputCacheManager = {}
"settings-sharelatex": @Settings = { path: compilesDir: "/compiles/dir" } "settings-sharelatex": @Settings = { path: compilesDir: "/compiles/dir" }
"logger-sharelatex": @logger = { log: sinon.stub() } "logger-sharelatex": @logger = { log: sinon.stub() }
"child_process": @child_process = {} "child_process": @child_process = {}
@@ -26,6 +27,15 @@ describe "CompileManager", ->
path: "output.pdf" path: "output.pdf"
type: "pdf" type: "pdf"
}] }]
@build_files = [{
path: "output.log"
type: "log"
build: 1234
}, {
path: "output.pdf"
type: "pdf"
build: 1234
}]
@request = @request =
resources: @resources = "mock-resources" resources: @resources = "mock-resources"
rootResourcePath: @rootResourcePath = "main.tex" rootResourcePath: @rootResourcePath = "main.tex"
@@ -37,6 +47,7 @@ describe "CompileManager", ->
@ResourceWriter.syncResourcesToDisk = sinon.stub().callsArg(3) @ResourceWriter.syncResourcesToDisk = sinon.stub().callsArg(3)
@LatexRunner.runLatex = sinon.stub().callsArg(2) @LatexRunner.runLatex = sinon.stub().callsArg(2)
@OutputFileFinder.findOutputFiles = sinon.stub().callsArgWith(2, null, @output_files) @OutputFileFinder.findOutputFiles = sinon.stub().callsArgWith(2, null, @output_files)
@OutputCacheManager.saveOutputFiles = sinon.stub().callsArgWith(2, null, @build_files)
@CompileManager.doCompile @request, @callback @CompileManager.doCompile @request, @callback
it "should write the resources to disk", -> it "should write the resources to disk", ->
@@ -60,7 +71,8 @@ describe "CompileManager", ->
.should.equal true .should.equal true
it "should return the output files", -> it "should return the output files", ->
@callback.calledWith(null, @output_files).should.equal true console.log 'output_files', @build_files
@callback.calledWith(null, @build_files).should.equal true
describe "clearProject", -> describe "clearProject", ->
describe "succesfully", -> describe "succesfully", ->