From 77b4247f86a0c955f447984112e246ff10203199 Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Thu, 26 Feb 2015 15:30:57 +0000 Subject: [PATCH] fix tests to allow for build parameter --- .../test/unit/coffee/CompileControllerTests.coffee | 3 +++ .../test/unit/coffee/CompileManagerTests.coffee | 14 +++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/services/clsi/test/unit/coffee/CompileControllerTests.coffee b/services/clsi/test/unit/coffee/CompileControllerTests.coffee index d2babf7c2b..bc2d988132 100644 --- a/services/clsi/test/unit/coffee/CompileControllerTests.coffee +++ b/services/clsi/test/unit/coffee/CompileControllerTests.coffee @@ -36,9 +36,11 @@ describe "CompileController", -> @output_files = [{ path: "output.pdf" type: "pdf" + build: 1234 }, { path: "output.log" type: "log" + build: 1234 }] @RequestParser.parse = sinon.stub().callsArgWith(1, null, @request) @ProjectPersistenceManager.markProjectAsJustAccessed = sinon.stub().callsArg(1) @@ -73,6 +75,7 @@ describe "CompileController", -> outputFiles: @output_files.map (file) => url: "#{@Settings.apis.clsi.url}/project/#{@project_id}/output/#{file.path}" type: file.type + build: file.build ) .should.equal true diff --git a/services/clsi/test/unit/coffee/CompileManagerTests.coffee b/services/clsi/test/unit/coffee/CompileManagerTests.coffee index 5d110eb17e..8923dea02f 100644 --- a/services/clsi/test/unit/coffee/CompileManagerTests.coffee +++ b/services/clsi/test/unit/coffee/CompileManagerTests.coffee @@ -12,6 +12,7 @@ describe "CompileManager", -> "./LatexRunner": @LatexRunner = {} "./ResourceWriter": @ResourceWriter = {} "./OutputFileFinder": @OutputFileFinder = {} + "./OutputCacheManager": @OutputCacheManager = {} "settings-sharelatex": @Settings = { path: compilesDir: "/compiles/dir" } "logger-sharelatex": @logger = { log: sinon.stub() } "child_process": @child_process = {} @@ -26,6 +27,15 @@ describe "CompileManager", -> path: "output.pdf" type: "pdf" }] + @build_files = [{ + path: "output.log" + type: "log" + build: 1234 + }, { + path: "output.pdf" + type: "pdf" + build: 1234 + }] @request = resources: @resources = "mock-resources" rootResourcePath: @rootResourcePath = "main.tex" @@ -37,6 +47,7 @@ describe "CompileManager", -> @ResourceWriter.syncResourcesToDisk = sinon.stub().callsArg(3) @LatexRunner.runLatex = sinon.stub().callsArg(2) @OutputFileFinder.findOutputFiles = sinon.stub().callsArgWith(2, null, @output_files) + @OutputCacheManager.saveOutputFiles = sinon.stub().callsArgWith(2, null, @build_files) @CompileManager.doCompile @request, @callback it "should write the resources to disk", -> @@ -60,7 +71,8 @@ describe "CompileManager", -> .should.equal true 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 "succesfully", ->