|
@@ -8,10 +8,9 @@ const MODULE_PATH = require('path').join(
|
|
|
describe('OutputController', function () {
|
|
describe('OutputController', function () {
|
|
|
describe('createOutputZip', function () {
|
|
describe('createOutputZip', function () {
|
|
|
beforeEach(function () {
|
|
beforeEach(function () {
|
|
|
- this.archive = {
|
|
|
|
|
- on: sinon.stub(),
|
|
|
|
|
- pipe: sinon.stub(),
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ this.archive = {}
|
|
|
|
|
+
|
|
|
|
|
+ this.pipeline = sinon.stub().resolves()
|
|
|
|
|
|
|
|
this.archiveFilesForBuild = sinon.stub().resolves(this.archive)
|
|
this.archiveFilesForBuild = sinon.stub().resolves(this.archive)
|
|
|
|
|
|
|
@@ -20,6 +19,9 @@ describe('OutputController', function () {
|
|
|
'./OutputFileArchiveManager': {
|
|
'./OutputFileArchiveManager': {
|
|
|
archiveFilesForBuild: this.archiveFilesForBuild,
|
|
archiveFilesForBuild: this.archiveFilesForBuild,
|
|
|
},
|
|
},
|
|
|
|
|
+ 'node:stream/promises': {
|
|
|
|
|
+ pipeline: this.pipeline,
|
|
|
|
|
+ },
|
|
|
},
|
|
},
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
@@ -40,12 +42,15 @@ describe('OutputController', function () {
|
|
|
files: ['output.tex'],
|
|
files: ['output.tex'],
|
|
|
},
|
|
},
|
|
|
}
|
|
}
|
|
|
- this.archive.pipe.callsFake(() => done())
|
|
|
|
|
|
|
+ this.pipeline.callsFake(() => {
|
|
|
|
|
+ done()
|
|
|
|
|
+ return Promise.resolve()
|
|
|
|
|
+ })
|
|
|
this.OutputController.createOutputZip(this.req, this.res)
|
|
this.OutputController.createOutputZip(this.req, this.res)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- it('pipes the archive to the response', function () {
|
|
|
|
|
- sinon.assert.calledWith(this.archive.pipe, this.res)
|
|
|
|
|
|
|
+ it('creates a pipeline from the archive to the response', function () {
|
|
|
|
|
+ sinon.assert.calledWith(this.pipeline, this.archive, this.res)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('calls the express convenience method to set attachment headers', function () {
|
|
it('calls the express convenience method to set attachment headers', function () {
|