TimeoutTests.js 1.6 KB

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