BrokenLatexFileTests.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /* eslint-disable
  2. no-unused-vars,
  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('Broken LaTeX file', function () {
  15. before(function (done) {
  16. this.broken_request = {
  17. resources: [
  18. {
  19. path: 'main.tex',
  20. content: `\
  21. \\documentclass{articl % :(
  22. \\begin{documen % :(
  23. Broken
  24. \\end{documen % :(\
  25. `
  26. }
  27. ]
  28. }
  29. this.correct_request = {
  30. resources: [
  31. {
  32. path: 'main.tex',
  33. content: `\
  34. \\documentclass{article}
  35. \\begin{document}
  36. Hello world
  37. \\end{document}\
  38. `
  39. }
  40. ]
  41. }
  42. return ClsiApp.ensureRunning(done)
  43. })
  44. describe('on first run', function () {
  45. before(function (done) {
  46. this.project_id = Client.randomId()
  47. return Client.compile(
  48. this.project_id,
  49. this.broken_request,
  50. (error, res, body) => {
  51. this.error = error
  52. this.res = res
  53. this.body = body
  54. return done()
  55. }
  56. )
  57. })
  58. return it('should return a failure status', function () {
  59. return this.body.compile.status.should.equal('failure')
  60. })
  61. })
  62. return describe('on second run', function () {
  63. before(function (done) {
  64. this.project_id = Client.randomId()
  65. return Client.compile(this.project_id, this.correct_request, () => {
  66. return Client.compile(
  67. this.project_id,
  68. this.broken_request,
  69. (error, res, body) => {
  70. this.error = error
  71. this.res = res
  72. this.body = body
  73. return done()
  74. }
  75. )
  76. })
  77. })
  78. return it('should return a failure status', function () {
  79. return this.body.compile.status.should.equal('failure')
  80. })
  81. })
  82. })