TimeoutTests.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. const { expect } = require('chai')
  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. it('should return isInitialCompile flag', function () {
  55. expect(this.body.compile.stats.isInitialCompile).to.equal(1)
  56. })
  57. return it('should return the log output file name', function () {
  58. const outputFilePaths = this.body.compile.outputFiles.map(x => x.path)
  59. return outputFilePaths.should.include('output.log')
  60. })
  61. })