SimpleLatexFileTests.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /* eslint-disable
  2. handle-callback-err,
  3. */
  4. // TODO: This file was created by bulk-decaffeinate.
  5. // Fix any style issues and re-enable lint.
  6. /*
  7. * decaffeinate suggestions:
  8. * DS102: Remove unnecessary code created because of implicit returns
  9. * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
  10. */
  11. const Client = require('./helpers/Client')
  12. const request = require('request')
  13. const ClsiApp = require('./helpers/ClsiApp')
  14. describe('Simple LaTeX file', function () {
  15. before(function (done) {
  16. this.project_id = Client.randomId()
  17. this.request = {
  18. resources: [
  19. {
  20. path: 'main.tex',
  21. content: `\
  22. \\documentclass{article}
  23. \\begin{document}
  24. Hello world
  25. \\end{document}\
  26. `
  27. }
  28. ]
  29. }
  30. return ClsiApp.ensureRunning(() => {
  31. return Client.compile(
  32. this.project_id,
  33. this.request,
  34. (error, res, body) => {
  35. this.error = error
  36. this.res = res
  37. this.body = body
  38. return done()
  39. }
  40. )
  41. })
  42. })
  43. it('should return the PDF', function () {
  44. const pdf = Client.getOutputFile(this.body, 'pdf')
  45. return pdf.type.should.equal('pdf')
  46. })
  47. it('should return the log', function () {
  48. const log = Client.getOutputFile(this.body, 'log')
  49. return log.type.should.equal('log')
  50. })
  51. it('should provide the pdf for download', function (done) {
  52. const pdf = Client.getOutputFile(this.body, 'pdf')
  53. return request.get(pdf.url, (error, res, body) => {
  54. res.statusCode.should.equal(200)
  55. return done()
  56. })
  57. })
  58. return it('should provide the log for download', function (done) {
  59. const log = Client.getOutputFile(this.body, 'pdf')
  60. return request.get(log.url, (error, res, body) => {
  61. res.statusCode.should.equal(200)
  62. return done()
  63. })
  64. })
  65. })