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
@@ -22,8 +22,8 @@ const modulePath =
const SandboxedModule = require('sandboxed-module')
const { EventEmitter } = require('events')
describe('ProjectZipStreamManager', function() {
beforeEach(function() {
describe('ProjectZipStreamManager', function () {
beforeEach(function () {
this.project_id = 'project-id-123'
this.callback = sinon.stub()
this.archive = {
@@ -40,9 +40,9 @@ describe('ProjectZipStreamManager', function() {
}))
})
describe('createZipStreamForMultipleProjects', function() {
describe('successfully', function() {
beforeEach(function(done) {
describe('createZipStreamForMultipleProjects', function () {
describe('successfully', function () {
beforeEach(function (done) {
this.project_ids = ['project-1', 'project-2']
this.zip_streams = {
'project-1': new EventEmitter(),
@@ -81,11 +81,11 @@ describe('ProjectZipStreamManager', function() {
return (this.archive.finalize = () => done())
})
it('should create a zip archive', function() {
it('should create a zip archive', function () {
return this.archiver.calledWith('zip').should.equal(true)
})
it('should return a stream before any processing is done', function() {
it('should return a stream before any processing is done', function () {
this.callback
.calledWith(sinon.match.falsy, this.archive)
.should.equal(true)
@@ -94,7 +94,7 @@ describe('ProjectZipStreamManager', function() {
.should.equal(true)
})
it('should get a zip stream for all of the projects', function() {
it('should get a zip stream for all of the projects', function () {
return Array.from(this.project_ids).map(project_id =>
this.ProjectZipStreamManager.createZipStreamForProject
.calledWith(project_id)
@@ -102,7 +102,7 @@ describe('ProjectZipStreamManager', function() {
)
})
it('should get the names of each project', function() {
it('should get the names of each project', function () {
return Array.from(this.project_ids).map(project_id =>
this.ProjectGetter.getProject
.calledWith(project_id, { name: true })
@@ -110,7 +110,7 @@ describe('ProjectZipStreamManager', function() {
)
})
it('should add all of the projects to the zip', function() {
it('should add all of the projects to the zip', function () {
return Array.from(this.project_ids).map(project_id =>
this.archive.append
.calledWith(this.zip_streams[project_id], {
@@ -122,9 +122,9 @@ describe('ProjectZipStreamManager', function() {
})
})
describe('createZipStreamForProject', function() {
describe('successfully', function() {
beforeEach(function() {
describe('createZipStreamForProject', function () {
describe('successfully', function () {
beforeEach(function () {
this.ProjectZipStreamManager.addAllDocsToArchive = sinon
.stub()
.callsArg(2)
@@ -138,11 +138,11 @@ describe('ProjectZipStreamManager', function() {
)
})
it('should create a zip archive', function() {
it('should create a zip archive', function () {
return this.archiver.calledWith('zip').should.equal(true)
})
it('should return a stream before any processing is done', function() {
it('should return a stream before any processing is done', function () {
this.callback
.calledWith(sinon.match.falsy, this.archive)
.should.equal(true)
@@ -154,25 +154,25 @@ describe('ProjectZipStreamManager', function() {
.should.equal(true)
})
it('should add all of the project docs to the zip', function() {
it('should add all of the project docs to the zip', function () {
return this.ProjectZipStreamManager.addAllDocsToArchive
.calledWith(this.project_id, this.archive)
.should.equal(true)
})
it('should add all of the project files to the zip', function() {
it('should add all of the project files to the zip', function () {
return this.ProjectZipStreamManager.addAllFilesToArchive
.calledWith(this.project_id, this.archive)
.should.equal(true)
})
it('should finalise the stream', function() {
it('should finalise the stream', function () {
return this.archive.finalize.called.should.equal(true)
})
})
describe('with an error adding docs', function() {
beforeEach(function() {
describe('with an error adding docs', function () {
beforeEach(function () {
this.ProjectZipStreamManager.addAllDocsToArchive = sinon
.stub()
.callsArgWith(2, new Error('something went wrong'))
@@ -186,13 +186,13 @@ describe('ProjectZipStreamManager', function() {
)
})
it('should log out an error', function() {
it('should log out an error', function () {
return this.logger.error
.calledWith(sinon.match.any, 'error adding docs to zip stream')
.should.equal(true)
})
it('should continue with the process', function() {
it('should continue with the process', function () {
this.ProjectZipStreamManager.addAllDocsToArchive.called.should.equal(
true
)
@@ -203,8 +203,8 @@ describe('ProjectZipStreamManager', function() {
})
})
describe('with an error adding files', function() {
beforeEach(function() {
describe('with an error adding files', function () {
beforeEach(function () {
this.ProjectZipStreamManager.addAllDocsToArchive = sinon
.stub()
.callsArg(2)
@@ -218,13 +218,13 @@ describe('ProjectZipStreamManager', function() {
)
})
it('should log out an error', function() {
it('should log out an error', function () {
return this.logger.error
.calledWith(sinon.match.any, 'error adding files to zip stream')
.should.equal(true)
})
it('should continue with the process', function() {
it('should continue with the process', function () {
this.ProjectZipStreamManager.addAllDocsToArchive.called.should.equal(
true
)
@@ -236,8 +236,8 @@ describe('ProjectZipStreamManager', function() {
})
})
describe('addAllDocsToArchive', function() {
beforeEach(function(done) {
describe('addAllDocsToArchive', function () {
beforeEach(function (done) {
this.docs = {
'/main.tex': {
lines: [
@@ -264,13 +264,13 @@ describe('ProjectZipStreamManager', function() {
)
})
it('should get the docs for the project', function() {
it('should get the docs for the project', function () {
return this.ProjectEntityHandler.getAllDocs
.calledWith(this.project_id)
.should.equal(true)
})
it('should add each doc to the archive', function() {
it('should add each doc to the archive', function () {
return (() => {
const result = []
for (let path in this.docs) {
@@ -287,8 +287,8 @@ describe('ProjectZipStreamManager', function() {
})
})
describe('addAllFilesToArchive', function() {
beforeEach(function() {
describe('addAllFilesToArchive', function () {
beforeEach(function () {
this.files = {
'/image.png': {
_id: 'file-id-1'
@@ -325,13 +325,13 @@ describe('ProjectZipStreamManager', function() {
})()
})
it('should get the files for the project', function() {
it('should get the files for the project', function () {
return this.ProjectEntityHandler.getAllFiles
.calledWith(this.project_id)
.should.equal(true)
})
it('should get a stream for each file', function() {
it('should get a stream for each file', function () {
return (() => {
const result = []
for (let path in this.files) {
@@ -346,7 +346,7 @@ describe('ProjectZipStreamManager', function() {
})()
})
it('should add each file to the archive', function() {
it('should add each file to the archive', function () {
return (() => {
const result = []
for (let path in this.files) {