Merge pull request #3495 from overleaf/ae-prettier-2

Upgrade Prettier to v2

GitOrigin-RevId: 85aa3fa1acb6332c4f58c46165a43d1a51471f33
This commit is contained in:
Alf Eaton
2021-04-14 14:17:21 +01:00
committed by Copybot
parent 930d7ba028
commit 1ebc8a79cb
582 changed files with 20382 additions and 20374 deletions
@@ -18,8 +18,8 @@ const SandboxedModule = require('sandboxed-module')
const MockRequest = require('../helpers/MockRequest')
const MockResponse = require('../helpers/MockResponse')
describe('ProjectDownloadsController', function() {
beforeEach(function() {
describe('ProjectDownloadsController', function () {
beforeEach(function () {
this.project_id = 'project-id-123'
this.req = new MockRequest()
this.res = new MockResponse()
@@ -39,8 +39,8 @@ describe('ProjectDownloadsController', function() {
))
})
describe('downloadProject', function() {
beforeEach(function() {
describe('downloadProject', function () {
beforeEach(function () {
this.stream = { pipe: sinon.stub() }
this.ProjectZipStreamManager.createZipStreamForProject = sinon
.stub()
@@ -63,47 +63,47 @@ describe('ProjectDownloadsController', function() {
)
})
it('should create a zip from the project', function() {
it('should create a zip from the project', function () {
return this.ProjectZipStreamManager.createZipStreamForProject
.calledWith(this.project_id)
.should.equal(true)
})
it('should stream the zip to the request', function() {
it('should stream the zip to the request', function () {
return this.stream.pipe.calledWith(this.res).should.equal(true)
})
it('should set the correct content type on the request', function() {
it('should set the correct content type on the request', function () {
return this.res.contentType
.calledWith('application/zip')
.should.equal(true)
})
it('should flush the project to mongo', function() {
it('should flush the project to mongo', function () {
return this.DocumentUpdaterHandler.flushProjectToMongo
.calledWith(this.project_id)
.should.equal(true)
})
it("should look up the project's name", function() {
it("should look up the project's name", function () {
return this.ProjectGetter.getProject
.calledWith(this.project_id, { name: true })
.should.equal(true)
})
it('should name the downloaded file after the project', function() {
it('should name the downloaded file after the project', function () {
return this.res.setContentDisposition
.calledWith('attachment', { filename: `${this.project_name}.zip` })
.should.equal(true)
})
it('should record the action via Metrics', function() {
it('should record the action via Metrics', function () {
return this.metrics.inc.calledWith('zip-downloads').should.equal(true)
})
})
describe('downloadMultipleProjects', function() {
beforeEach(function() {
describe('downloadMultipleProjects', function () {
beforeEach(function () {
this.stream = { pipe: sinon.stub() }
this.ProjectZipStreamManager.createZipStreamForMultipleProjects = sinon
.stub()
@@ -123,29 +123,29 @@ describe('ProjectDownloadsController', function() {
)
})
it('should create a zip from the project', function() {
it('should create a zip from the project', function () {
return this.ProjectZipStreamManager.createZipStreamForMultipleProjects
.calledWith(this.project_ids)
.should.equal(true)
})
it('should stream the zip to the request', function() {
it('should stream the zip to the request', function () {
return this.stream.pipe.calledWith(this.res).should.equal(true)
})
it('should set the correct content type on the request', function() {
it('should set the correct content type on the request', function () {
return this.res.contentType
.calledWith('application/zip')
.should.equal(true)
})
it('should flush the projects to mongo', function() {
it('should flush the projects to mongo', function () {
return this.DocumentUpdaterHandler.flushMultipleProjectsToMongo
.calledWith(this.project_ids)
.should.equal(true)
})
it('should name the downloaded file after the project', function() {
it('should name the downloaded file after the project', function () {
return this.res.setContentDisposition
.calledWith('attachment', {
filename: 'Overleaf Projects (2 items).zip'
@@ -153,7 +153,7 @@ describe('ProjectDownloadsController', function() {
.should.equal(true)
})
it('should record the action via Metrics', function() {
it('should record the action via Metrics', function () {
return this.metrics.inc
.calledWith('zip-downloads-multiple')
.should.equal(true)