[misc] bump the dev-env to 3.3.2
This commit is contained in:
@@ -19,8 +19,8 @@ const modulePath = require('path').join(
|
||||
)
|
||||
const tk = require('timekeeper')
|
||||
|
||||
describe('CompileController', function() {
|
||||
beforeEach(function() {
|
||||
describe('CompileController', function () {
|
||||
beforeEach(function () {
|
||||
this.CompileController = SandboxedModule.require(modulePath, {
|
||||
requires: {
|
||||
'./CompileManager': (this.CompileManager = {}),
|
||||
@@ -47,8 +47,8 @@ describe('CompileController', function() {
|
||||
return (this.next = sinon.stub())
|
||||
})
|
||||
|
||||
describe('compile', function() {
|
||||
beforeEach(function() {
|
||||
describe('compile', function () {
|
||||
beforeEach(function () {
|
||||
this.req.body = {
|
||||
compile: 'mock-body'
|
||||
}
|
||||
@@ -82,40 +82,40 @@ describe('CompileController', function() {
|
||||
return (this.res.send = sinon.stub())
|
||||
})
|
||||
|
||||
describe('successfully', function() {
|
||||
beforeEach(function() {
|
||||
describe('successfully', function () {
|
||||
beforeEach(function () {
|
||||
this.CompileManager.doCompileWithLock = sinon
|
||||
.stub()
|
||||
.callsArgWith(1, null, this.output_files)
|
||||
return this.CompileController.compile(this.req, this.res)
|
||||
})
|
||||
|
||||
it('should parse the request', function() {
|
||||
it('should parse the request', function () {
|
||||
return this.RequestParser.parse
|
||||
.calledWith(this.req.body)
|
||||
.should.equal(true)
|
||||
})
|
||||
|
||||
it('should run the compile for the specified project', function() {
|
||||
it('should run the compile for the specified project', function () {
|
||||
return this.CompileManager.doCompileWithLock
|
||||
.calledWith(this.request_with_project_id)
|
||||
.should.equal(true)
|
||||
})
|
||||
|
||||
it('should mark the project as accessed', function() {
|
||||
it('should mark the project as accessed', function () {
|
||||
return this.ProjectPersistenceManager.markProjectAsJustAccessed
|
||||
.calledWith(this.project_id)
|
||||
.should.equal(true)
|
||||
})
|
||||
|
||||
return it('should return the JSON response', function() {
|
||||
return it('should return the JSON response', function () {
|
||||
this.res.status.calledWith(200).should.equal(true)
|
||||
return this.res.send
|
||||
.calledWith({
|
||||
compile: {
|
||||
status: 'success',
|
||||
error: null,
|
||||
outputFiles: this.output_files.map(file => {
|
||||
outputFiles: this.output_files.map((file) => {
|
||||
return {
|
||||
url: `${this.Settings.apis.clsi.url}/project/${this.project_id}/build/${file.build}/output/${file.path}`,
|
||||
path: file.path,
|
||||
@@ -129,15 +129,15 @@ describe('CompileController', function() {
|
||||
})
|
||||
})
|
||||
|
||||
describe('with an error', function() {
|
||||
beforeEach(function() {
|
||||
describe('with an error', function () {
|
||||
beforeEach(function () {
|
||||
this.CompileManager.doCompileWithLock = sinon
|
||||
.stub()
|
||||
.callsArgWith(1, new Error((this.message = 'error message')), null)
|
||||
return this.CompileController.compile(this.req, this.res)
|
||||
})
|
||||
|
||||
return it('should return the JSON response with the error', function() {
|
||||
return it('should return the JSON response with the error', function () {
|
||||
this.res.status.calledWith(500).should.equal(true)
|
||||
return this.res.send
|
||||
.calledWith({
|
||||
@@ -151,8 +151,8 @@ describe('CompileController', function() {
|
||||
})
|
||||
})
|
||||
|
||||
describe('when the request times out', function() {
|
||||
beforeEach(function() {
|
||||
describe('when the request times out', function () {
|
||||
beforeEach(function () {
|
||||
this.error = new Error((this.message = 'container timed out'))
|
||||
this.error.timedout = true
|
||||
this.CompileManager.doCompileWithLock = sinon
|
||||
@@ -161,7 +161,7 @@ describe('CompileController', function() {
|
||||
return this.CompileController.compile(this.req, this.res)
|
||||
})
|
||||
|
||||
return it('should return the JSON response with the timeout status', function() {
|
||||
return it('should return the JSON response with the timeout status', function () {
|
||||
this.res.status.calledWith(200).should.equal(true)
|
||||
return this.res.send
|
||||
.calledWith({
|
||||
@@ -175,15 +175,15 @@ describe('CompileController', function() {
|
||||
})
|
||||
})
|
||||
|
||||
return describe('when the request returns no output files', function() {
|
||||
beforeEach(function() {
|
||||
return describe('when the request returns no output files', function () {
|
||||
beforeEach(function () {
|
||||
this.CompileManager.doCompileWithLock = sinon
|
||||
.stub()
|
||||
.callsArgWith(1, null, [])
|
||||
return this.CompileController.compile(this.req, this.res)
|
||||
})
|
||||
|
||||
return it('should return the JSON response with the failure status', function() {
|
||||
return it('should return the JSON response with the failure status', function () {
|
||||
this.res.status.calledWith(200).should.equal(true)
|
||||
return this.res.send
|
||||
.calledWith({
|
||||
@@ -198,8 +198,8 @@ describe('CompileController', function() {
|
||||
})
|
||||
})
|
||||
|
||||
describe('syncFromCode', function() {
|
||||
beforeEach(function() {
|
||||
describe('syncFromCode', function () {
|
||||
beforeEach(function () {
|
||||
this.file = 'main.tex'
|
||||
this.line = 42
|
||||
this.column = 5
|
||||
@@ -218,7 +218,7 @@ describe('CompileController', function() {
|
||||
return this.CompileController.syncFromCode(this.req, this.res, this.next)
|
||||
})
|
||||
|
||||
it('should find the corresponding location in the PDF', function() {
|
||||
it('should find the corresponding location in the PDF', function () {
|
||||
return this.CompileManager.syncFromCode
|
||||
.calledWith(
|
||||
this.project_id,
|
||||
@@ -230,7 +230,7 @@ describe('CompileController', function() {
|
||||
.should.equal(true)
|
||||
})
|
||||
|
||||
return it('should return the positions', function() {
|
||||
return it('should return the positions', function () {
|
||||
return this.res.json
|
||||
.calledWith({
|
||||
pdf: this.pdfPositions
|
||||
@@ -239,8 +239,8 @@ describe('CompileController', function() {
|
||||
})
|
||||
})
|
||||
|
||||
describe('syncFromPdf', function() {
|
||||
beforeEach(function() {
|
||||
describe('syncFromPdf', function () {
|
||||
beforeEach(function () {
|
||||
this.page = 5
|
||||
this.h = 100.23
|
||||
this.v = 45.67
|
||||
@@ -259,13 +259,13 @@ describe('CompileController', function() {
|
||||
return this.CompileController.syncFromPdf(this.req, this.res, this.next)
|
||||
})
|
||||
|
||||
it('should find the corresponding location in the code', function() {
|
||||
it('should find the corresponding location in the code', function () {
|
||||
return this.CompileManager.syncFromPdf
|
||||
.calledWith(this.project_id, undefined, this.page, this.h, this.v)
|
||||
.should.equal(true)
|
||||
})
|
||||
|
||||
return it('should return the positions', function() {
|
||||
return it('should return the positions', function () {
|
||||
return this.res.json
|
||||
.calledWith({
|
||||
code: this.codePositions
|
||||
@@ -274,8 +274,8 @@ describe('CompileController', function() {
|
||||
})
|
||||
})
|
||||
|
||||
return describe('wordcount', function() {
|
||||
beforeEach(function() {
|
||||
return describe('wordcount', function () {
|
||||
beforeEach(function () {
|
||||
this.file = 'main.tex'
|
||||
this.project_id = 'mock-project-id'
|
||||
this.req.params = { project_id: this.project_id }
|
||||
@@ -290,14 +290,14 @@ describe('CompileController', function() {
|
||||
.callsArgWith(4, null, (this.texcount = ['mock-texcount']))
|
||||
})
|
||||
|
||||
it('should return the word count of a file', function() {
|
||||
it('should return the word count of a file', function () {
|
||||
this.CompileController.wordcount(this.req, this.res, this.next)
|
||||
return this.CompileManager.wordcount
|
||||
.calledWith(this.project_id, undefined, this.file, this.image)
|
||||
.should.equal(true)
|
||||
})
|
||||
|
||||
it('should return the texcount info', function() {
|
||||
it('should return the texcount info', function () {
|
||||
this.CompileController.wordcount(this.req, this.res, this.next)
|
||||
return this.res.json
|
||||
.calledWith({
|
||||
@@ -306,8 +306,8 @@ describe('CompileController', function() {
|
||||
.should.equal(true)
|
||||
})
|
||||
|
||||
describe('when allowedImages is set', function() {
|
||||
beforeEach(function() {
|
||||
describe('when allowedImages is set', function () {
|
||||
beforeEach(function () {
|
||||
this.Settings.clsi = { docker: {} }
|
||||
this.Settings.clsi.docker.allowedImages = [
|
||||
'repo/image:tag1',
|
||||
@@ -317,28 +317,28 @@ describe('CompileController', function() {
|
||||
this.res.status = sinon.stub().returns({ send: this.res.send })
|
||||
})
|
||||
|
||||
describe('with an invalid image', function() {
|
||||
beforeEach(function() {
|
||||
describe('with an invalid image', function () {
|
||||
beforeEach(function () {
|
||||
this.req.query.image = 'something/evil:1337'
|
||||
this.CompileController.wordcount(this.req, this.res, this.next)
|
||||
})
|
||||
it('should return a 400', function() {
|
||||
it('should return a 400', function () {
|
||||
expect(this.res.status.calledWith(400)).to.equal(true)
|
||||
})
|
||||
it('should not run the query', function() {
|
||||
it('should not run the query', function () {
|
||||
expect(this.CompileManager.wordcount.called).to.equal(false)
|
||||
})
|
||||
})
|
||||
|
||||
describe('with a valid image', function() {
|
||||
beforeEach(function() {
|
||||
describe('with a valid image', function () {
|
||||
beforeEach(function () {
|
||||
this.req.query.image = 'repo/image:tag1'
|
||||
this.CompileController.wordcount(this.req, this.res, this.next)
|
||||
})
|
||||
it('should not return a 400', function() {
|
||||
it('should not return a 400', function () {
|
||||
expect(this.res.status.calledWith(400)).to.equal(false)
|
||||
})
|
||||
it('should run the query', function() {
|
||||
it('should run the query', function () {
|
||||
expect(this.CompileManager.wordcount.called).to.equal(true)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user