overleaf/services/clsi/test/smoke/coffee/SmokeTests.coffee

40 lines
983 B
CoffeeScript
Raw Normal View History

2014-02-12 12:27:43 -05:00
chai = require("chai")
chai.should() unless Object.prototype.should?
2014-02-12 12:27:43 -05:00
expect = chai.expect
request = require "request"
2014-02-13 04:33:39 -05:00
Settings = require "settings-sharelatex"
2014-02-12 12:27:43 -05:00
2014-02-13 04:33:39 -05:00
buildUrl = (path) -> "http://#{Settings.internal.clsi.host}:#{Settings.internal.clsi.port}/#{path}"
2014-02-12 12:27:43 -05:00
random = require("crypto").randomBytes(4).toString("hex")
url = buildUrl("project/smoketest-#{random}/compile")
2014-02-12 12:27:43 -05:00
describe "Running a compile", ->
before (done) ->
request.post {
url: url
2014-02-12 12:27:43 -05:00
json:
compile:
resources: [
path: "main.tex"
content: """
\\documentclass{article}
\\begin{document}
Hello world
\\end{document}
"""
]
}, (@error, @response, @body) =>
done()
it "should return the pdf", ->
for file in @body.compile.outputFiles
return if file.type == "pdf"
throw new Error("no pdf returned")
it "should return the log", ->
for file in @body.compile.outputFiles
return if file.type == "log"
throw new Error("no log returned")