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

View File

@@ -19,10 +19,10 @@ const modulePath =
'../../../../app/src/Features/Project/ProjectOptionsHandler.js'
const SandboxedModule = require('sandboxed-module')
describe('ProjectOptionsHandler', function() {
describe('ProjectOptionsHandler', function () {
const project_id = '4eecaffcbffa66588e000008'
beforeEach(function() {
beforeEach(function () {
let Project
this.projectModel = Project = class Project {
constructor(options) {}
@@ -47,8 +47,8 @@ describe('ProjectOptionsHandler', function() {
})
})
describe('Setting the compiler', function() {
it('should perform and update on mongo', function(done) {
describe('Setting the compiler', function () {
it('should perform and update on mongo', function (done) {
this.handler.setCompiler(project_id, 'xeLaTeX', err => {
const args = this.projectModel.updateOne.args[0]
args[0]._id.should.equal(project_id)
@@ -57,15 +57,15 @@ describe('ProjectOptionsHandler', function() {
})
})
it('should not perform and update on mongo if it is not a recognised compiler', function(done) {
it('should not perform and update on mongo if it is not a recognised compiler', function (done) {
this.handler.setCompiler(project_id, 'something', err => {
this.projectModel.updateOne.called.should.equal(false)
done()
})
})
describe('when called without arg', function() {
it('should callback with null', function(done) {
describe('when called without arg', function () {
it('should callback with null', function (done) {
this.handler.setCompiler(project_id, null, err => {
expect(err).to.be.undefined
this.projectModel.updateOne.callCount.should.equal(0)
@@ -74,12 +74,12 @@ describe('ProjectOptionsHandler', function() {
})
})
describe('when mongo update error occurs', function() {
beforeEach(function() {
describe('when mongo update error occurs', function () {
beforeEach(function () {
this.projectModel.updateOne = sinon.stub().yields('error')
})
it('should callback with error', function(done) {
it('should callback with error', function (done) {
this.handler.setCompiler(project_id, 'xeLaTeX', err => {
err.should.equal('error')
done()
@@ -88,8 +88,8 @@ describe('ProjectOptionsHandler', function() {
})
})
describe('Setting the imageName', function() {
it('should perform and update on mongo', function(done) {
describe('Setting the imageName', function () {
it('should perform and update on mongo', function (done) {
this.handler.setImageName(project_id, 'texlive-1234.5', err => {
const args = this.projectModel.updateOne.args[0]
args[0]._id.should.equal(project_id)
@@ -98,15 +98,15 @@ describe('ProjectOptionsHandler', function() {
})
})
it('should not perform and update on mongo if it is not a reconised compiler', function(done) {
it('should not perform and update on mongo if it is not a reconised compiler', function (done) {
this.handler.setImageName(project_id, 'something', err => {
this.projectModel.updateOne.called.should.equal(false)
done()
})
})
describe('when called without arg', function() {
it('should callback with null', function(done) {
describe('when called without arg', function () {
it('should callback with null', function (done) {
this.handler.setImageName(project_id, null, err => {
expect(err).to.be.undefined
this.projectModel.updateOne.callCount.should.equal(0)
@@ -115,12 +115,12 @@ describe('ProjectOptionsHandler', function() {
})
})
describe('when mongo update error occurs', function() {
beforeEach(function() {
describe('when mongo update error occurs', function () {
beforeEach(function () {
this.projectModel.updateOne = sinon.stub().yields('error')
})
it('should callback with error', function(done) {
it('should callback with error', function (done) {
this.handler.setImageName(project_id, 'texlive-1234.5', err => {
err.should.equal('error')
done()
@@ -129,8 +129,8 @@ describe('ProjectOptionsHandler', function() {
})
})
describe('setting the spellCheckLanguage', function() {
it('should perform and update on mongo', function(done) {
describe('setting the spellCheckLanguage', function () {
it('should perform and update on mongo', function (done) {
this.handler.setSpellCheckLanguage(project_id, 'fr', err => {
const args = this.projectModel.updateOne.args[0]
args[0]._id.should.equal(project_id)
@@ -139,26 +139,26 @@ describe('ProjectOptionsHandler', function() {
})
})
it('should not perform and update on mongo if it is not a reconised compiler', function(done) {
it('should not perform and update on mongo if it is not a reconised compiler', function (done) {
this.handler.setSpellCheckLanguage(project_id, 'no a lang', err => {
this.projectModel.updateOne.called.should.equal(false)
done()
})
})
it('should perform and update on mongo if the language is blank (means turn it off)', function(done) {
it('should perform and update on mongo if the language is blank (means turn it off)', function (done) {
this.handler.setSpellCheckLanguage(project_id, '', err => {
this.projectModel.updateOne.called.should.equal(true)
done()
})
})
describe('when mongo update error occurs', function() {
beforeEach(function() {
describe('when mongo update error occurs', function () {
beforeEach(function () {
this.projectModel.updateOne = sinon.stub().yields('error')
})
it('should callback with error', function(done) {
it('should callback with error', function (done) {
this.handler.setSpellCheckLanguage(project_id, 'fr', err => {
err.should.equal('error')
done()
@@ -167,8 +167,8 @@ describe('ProjectOptionsHandler', function() {
})
})
describe('setting the brandVariationId', function() {
it('should perform and update on mongo', function(done) {
describe('setting the brandVariationId', function () {
it('should perform and update on mongo', function (done) {
this.handler.setBrandVariationId(project_id, '123', err => {
const args = this.projectModel.updateOne.args[0]
args[0]._id.should.equal(project_id)
@@ -177,26 +177,26 @@ describe('ProjectOptionsHandler', function() {
})
})
it('should not perform and update on mongo if there is no brand variation', function(done) {
it('should not perform and update on mongo if there is no brand variation', function (done) {
this.handler.setBrandVariationId(project_id, null, err => {
this.projectModel.updateOne.called.should.equal(false)
done()
})
})
it('should not perform and update on mongo if brand variation is an empty string', function(done) {
it('should not perform and update on mongo if brand variation is an empty string', function (done) {
this.handler.setBrandVariationId(project_id, '', err => {
this.projectModel.updateOne.called.should.equal(false)
done()
})
})
describe('when mongo update error occurs', function() {
beforeEach(function() {
describe('when mongo update error occurs', function () {
beforeEach(function () {
this.projectModel.updateOne = sinon.stub().yields('error')
})
it('should callback with error', function(done) {
it('should callback with error', function (done) {
this.handler.setBrandVariationId(project_id, '123', err => {
err.should.equal('error')
done()
@@ -205,8 +205,8 @@ describe('ProjectOptionsHandler', function() {
})
})
describe('unsetting the brandVariationId', function() {
it('should perform and update on mongo', function(done) {
describe('unsetting the brandVariationId', function () {
it('should perform and update on mongo', function (done) {
this.handler.unsetBrandVariationId(project_id, err => {
const args = this.projectModel.updateOne.args[0]
args[0]._id.should.equal(project_id)
@@ -215,12 +215,12 @@ describe('ProjectOptionsHandler', function() {
})
})
describe('when mongo update error occurs', function() {
beforeEach(function() {
describe('when mongo update error occurs', function () {
beforeEach(function () {
this.projectModel.updateOne = sinon.stub().yields('error')
})
it('should callback with error', function(done) {
it('should callback with error', function (done) {
this.handler.unsetBrandVariationId(project_id, err => {
err.should.equal('error')
done()