TimeoutTests.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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('Timed out compile', function () {
  15. before(function (done) {
  16. this.request = {
  17. options: {
  18. timeout: 10,
  19. }, // seconds
  20. resources: [
  21. {
  22. path: 'main.tex',
  23. content: `\
  24. \\documentclass{article}
  25. \\begin{document}
  26. \\def\\x{Hello!\\par\\x}
  27. \\x
  28. \\end{document}\
  29. `,
  30. },
  31. ],
  32. }
  33. this.project_id = Client.randomId()
  34. return ClsiApp.ensureRunning(() => {
  35. return Client.compile(
  36. this.project_id,
  37. this.request,
  38. (error, res, body) => {
  39. this.error = error
  40. this.res = res
  41. this.body = body
  42. return done()
  43. }
  44. )
  45. })
  46. })
  47. it('should return a timeout error', function () {
  48. return this.body.compile.error.should.equal('container timed out')
  49. })
  50. it('should return a timedout status', function () {
  51. return this.body.compile.status.should.equal('timedout')
  52. })
  53. return it('should return the log output file name', function () {
  54. const outputFilePaths = this.body.compile.outputFiles.map(x => x.path)
  55. return outputFilePaths.should.include('output.log')
  56. })
  57. })