|
|
@@ -50,7 +50,6 @@ function tryImageNameValidation(method, imageNameField) {
|
|
|
|
|
|
describe('CompileController', function () {
|
|
|
beforeEach(function () {
|
|
|
- this.buildId = 'build-id-123'
|
|
|
this.CompileController = SandboxedModule.require(modulePath, {
|
|
|
requires: {
|
|
|
'./CompileManager': (this.CompileManager = {}),
|
|
|
@@ -119,7 +118,6 @@ describe('CompileController', function () {
|
|
|
outputFiles: this.output_files,
|
|
|
stats: this.stats,
|
|
|
timings: this.timings,
|
|
|
- buildId: this.buildId,
|
|
|
})
|
|
|
this.CompileController.compile(this.req, this.res)
|
|
|
})
|
|
|
@@ -142,32 +140,21 @@ describe('CompileController', function () {
|
|
|
|
|
|
it('should return the JSON response', function () {
|
|
|
this.res.status.calledWith(200).should.equal(true)
|
|
|
- console.log(this.res.send.args[0][0].compile)
|
|
|
- sinon.assert.calledWith(
|
|
|
- this.res.send,
|
|
|
- sinon.match.has(
|
|
|
- 'compile',
|
|
|
- sinon.match({
|
|
|
+ this.res.send
|
|
|
+ .calledWith({
|
|
|
+ compile: {
|
|
|
status: 'success',
|
|
|
error: null,
|
|
|
stats: this.stats,
|
|
|
timings: this.timings,
|
|
|
outputUrlPrefix: '/zone/b',
|
|
|
- outputFiles: [
|
|
|
- ...this.output_files.map(file => ({
|
|
|
- url: `${this.Settings.apis.clsi.url}/project/${this.project_id}/build/${file.build}/output/${file.path}`,
|
|
|
- ...file,
|
|
|
- })),
|
|
|
- {
|
|
|
- url: `${this.Settings.apis.clsi.url}/project/${this.project_id}/build/${this.buildId}/output/output.zip`,
|
|
|
- build: this.buildId,
|
|
|
- path: 'output.zip',
|
|
|
- type: 'zip',
|
|
|
- },
|
|
|
- ],
|
|
|
- })
|
|
|
- )
|
|
|
- )
|
|
|
+ outputFiles: this.output_files.map(file => ({
|
|
|
+ url: `${this.Settings.apis.clsi.url}/project/${this.project_id}/build/${file.build}/output/${file.path}`,
|
|
|
+ ...file,
|
|
|
+ })),
|
|
|
+ },
|
|
|
+ })
|
|
|
+ .should.equal(true)
|
|
|
})
|
|
|
})
|
|
|
|
|
|
@@ -178,7 +165,6 @@ describe('CompileController', function () {
|
|
|
outputFiles: this.output_files,
|
|
|
stats: this.stats,
|
|
|
timings: this.timings,
|
|
|
- buildId: this.buildId,
|
|
|
})
|
|
|
this.CompileController.compile(this.req, this.res)
|
|
|
})
|
|
|
@@ -193,18 +179,10 @@ describe('CompileController', function () {
|
|
|
stats: this.stats,
|
|
|
timings: this.timings,
|
|
|
outputUrlPrefix: '',
|
|
|
- outputFiles: [
|
|
|
- ...this.output_files.map(file => ({
|
|
|
- url: `${this.Settings.apis.clsi.url}/project/${this.project_id}/build/${file.build}/output/${file.path}`,
|
|
|
- ...file,
|
|
|
- })),
|
|
|
- {
|
|
|
- url: `${this.Settings.apis.clsi.url}/project/${this.project_id}/build/${this.buildId}/output/output.zip`,
|
|
|
- build: this.buildId,
|
|
|
- path: 'output.zip',
|
|
|
- type: 'zip',
|
|
|
- },
|
|
|
- ],
|
|
|
+ outputFiles: this.output_files.map(file => ({
|
|
|
+ url: `${this.Settings.apis.clsi.url}/project/${this.project_id}/build/${file.build}/output/${file.path}`,
|
|
|
+ ...file,
|
|
|
+ })),
|
|
|
},
|
|
|
})
|
|
|
.should.equal(true)
|
|
|
@@ -229,7 +207,6 @@ describe('CompileController', function () {
|
|
|
outputFiles: this.output_files,
|
|
|
stats: this.stats,
|
|
|
timings: this.timings,
|
|
|
- buildId: this.buildId,
|
|
|
})
|
|
|
this.CompileController.compile(this.req, this.res)
|
|
|
})
|
|
|
@@ -244,18 +221,10 @@ describe('CompileController', function () {
|
|
|
stats: this.stats,
|
|
|
timings: this.timings,
|
|
|
outputUrlPrefix: '/zone/b',
|
|
|
- outputFiles: [
|
|
|
- ...this.output_files.map(file => ({
|
|
|
- url: `${this.Settings.apis.clsi.url}/project/${this.project_id}/build/${file.build}/output/${file.path}`,
|
|
|
- ...file,
|
|
|
- })),
|
|
|
- {
|
|
|
- url: `${this.Settings.apis.clsi.url}/project/${this.project_id}/build/${this.buildId}/output/output.zip`,
|
|
|
- build: this.buildId,
|
|
|
- path: 'output.zip',
|
|
|
- type: 'zip',
|
|
|
- },
|
|
|
- ],
|
|
|
+ outputFiles: this.output_files.map(file => ({
|
|
|
+ url: `${this.Settings.apis.clsi.url}/project/${this.project_id}/build/${file.build}/output/${file.path}`,
|
|
|
+ ...file,
|
|
|
+ })),
|
|
|
},
|
|
|
})
|
|
|
.should.equal(true)
|
|
|
@@ -281,7 +250,6 @@ describe('CompileController', function () {
|
|
|
outputFiles: this.output_files,
|
|
|
stats: this.stats,
|
|
|
timings: this.timings,
|
|
|
- buildId: this.buildId,
|
|
|
})
|
|
|
this.CompileController.compile(this.req, this.res)
|
|
|
})
|
|
|
@@ -296,18 +264,10 @@ describe('CompileController', function () {
|
|
|
stats: this.stats,
|
|
|
timings: this.timings,
|
|
|
outputUrlPrefix: '/zone/b',
|
|
|
- outputFiles: [
|
|
|
- ...this.output_files.map(file => ({
|
|
|
- url: `${this.Settings.apis.clsi.url}/project/${this.project_id}/build/${file.build}/output/${file.path}`,
|
|
|
- ...file,
|
|
|
- })),
|
|
|
- {
|
|
|
- url: `${this.Settings.apis.clsi.url}/project/${this.project_id}/build/${this.buildId}/output/output.zip`,
|
|
|
- build: this.buildId,
|
|
|
- path: 'output.zip',
|
|
|
- type: 'zip',
|
|
|
- },
|
|
|
- ],
|
|
|
+ outputFiles: this.output_files.map(file => ({
|
|
|
+ url: `${this.Settings.apis.clsi.url}/project/${this.project_id}/build/${file.build}/output/${file.path}`,
|
|
|
+ ...file,
|
|
|
+ })),
|
|
|
},
|
|
|
})
|
|
|
.should.equal(true)
|
|
|
@@ -316,11 +276,9 @@ describe('CompileController', function () {
|
|
|
|
|
|
describe('with an error', function () {
|
|
|
beforeEach(function () {
|
|
|
- const error = new Error((this.message = 'error message'))
|
|
|
- error.buildId = this.buildId
|
|
|
this.CompileManager.doCompileWithLock = sinon
|
|
|
.stub()
|
|
|
- .callsArgWith(1, error, null)
|
|
|
+ .callsArgWith(1, new Error((this.message = 'error message')), null)
|
|
|
this.CompileController.compile(this.req, this.res)
|
|
|
})
|
|
|
|