decaffeinate: Convert BrokenLatexFileTests.coffee and 9 other files to JS
This commit is contained in:
@@ -1,41 +1,57 @@
|
||||
Client = require "./helpers/Client"
|
||||
request = require "request"
|
||||
require("chai").should()
|
||||
ClsiApp = require "./helpers/ClsiApp"
|
||||
/*
|
||||
* decaffeinate suggestions:
|
||||
* DS102: Remove unnecessary code created because of implicit returns
|
||||
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
||||
*/
|
||||
const Client = require("./helpers/Client");
|
||||
const request = require("request");
|
||||
require("chai").should();
|
||||
const ClsiApp = require("./helpers/ClsiApp");
|
||||
|
||||
describe "Simple LaTeX file", ->
|
||||
before (done) ->
|
||||
@project_id = Client.randomId()
|
||||
@request =
|
||||
resources: [
|
||||
path: "main.tex"
|
||||
content: '''
|
||||
\\documentclass{article}
|
||||
\\begin{document}
|
||||
Hello world
|
||||
\\end{document}
|
||||
'''
|
||||
describe("Simple LaTeX file", function() {
|
||||
before(function(done) {
|
||||
this.project_id = Client.randomId();
|
||||
this.request = {
|
||||
resources: [{
|
||||
path: "main.tex",
|
||||
content: `\
|
||||
\\documentclass{article}
|
||||
\\begin{document}
|
||||
Hello world
|
||||
\\end{document}\
|
||||
`
|
||||
}
|
||||
]
|
||||
ClsiApp.ensureRunning =>
|
||||
Client.compile @project_id, @request, (@error, @res, @body) => done()
|
||||
};
|
||||
return ClsiApp.ensureRunning(() => {
|
||||
return Client.compile(this.project_id, this.request, (error, res, body) => { this.error = error; this.res = res; this.body = body; return done(); });
|
||||
});
|
||||
});
|
||||
|
||||
it "should return the PDF", ->
|
||||
pdf = Client.getOutputFile(@body, "pdf")
|
||||
pdf.type.should.equal "pdf"
|
||||
it("should return the PDF", function() {
|
||||
const pdf = Client.getOutputFile(this.body, "pdf");
|
||||
return pdf.type.should.equal("pdf");
|
||||
});
|
||||
|
||||
it "should return the log", ->
|
||||
log = Client.getOutputFile(@body, "log")
|
||||
log.type.should.equal "log"
|
||||
it("should return the log", function() {
|
||||
const log = Client.getOutputFile(this.body, "log");
|
||||
return log.type.should.equal("log");
|
||||
});
|
||||
|
||||
it "should provide the pdf for download", (done) ->
|
||||
pdf = Client.getOutputFile(@body, "pdf")
|
||||
request.get pdf.url, (error, res, body) ->
|
||||
res.statusCode.should.equal 200
|
||||
done()
|
||||
it("should provide the pdf for download", function(done) {
|
||||
const pdf = Client.getOutputFile(this.body, "pdf");
|
||||
return request.get(pdf.url, function(error, res, body) {
|
||||
res.statusCode.should.equal(200);
|
||||
return done();
|
||||
});
|
||||
});
|
||||
|
||||
it "should provide the log for download", (done) ->
|
||||
log = Client.getOutputFile(@body, "pdf")
|
||||
request.get log.url, (error, res, body) ->
|
||||
res.statusCode.should.equal 200
|
||||
done()
|
||||
return it("should provide the log for download", function(done) {
|
||||
const log = Client.getOutputFile(this.body, "pdf");
|
||||
return request.get(log.url, function(error, res, body) {
|
||||
res.statusCode.should.equal(200);
|
||||
return done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user