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-15 02:05:22 +00:00
committed by Copybot
parent 930d7ba028
commit 1ebc8a79cb
582 changed files with 20382 additions and 20374 deletions
@@ -34,21 +34,21 @@ const MockFilestoreApiClass = require('./mocks/MockFilestoreApi')
let MockDocstoreApi, MockFilestoreApi
before(function() {
before(function () {
MockDocstoreApi = MockDocstoreApiClass.instance()
MockFilestoreApi = MockFilestoreApiClass.instance()
})
describe('ProjectDuplicateNames', function() {
beforeEach(function(done) {
describe('ProjectDuplicateNames', function () {
beforeEach(function (done) {
this.owner = new User()
this.owner.login(done)
this.project = {}
return (this.callback = sinon.stub())
})
describe('creating a project from the example template', function() {
beforeEach(function(done) {
describe('creating a project from the example template', function () {
beforeEach(function (done) {
return this.owner.createProject(
'example-project',
{ template: 'example' },
@@ -91,24 +91,24 @@ describe('ProjectDuplicateNames', function() {
)
})
it('should create a project', function() {
it('should create a project', function () {
expect(this.project.rootFolder[0].docs.length).to.equal(2)
return expect(this.project.rootFolder[0].fileRefs.length).to.equal(1)
})
it('should create two docs in the docstore', function() {
it('should create two docs in the docstore', function () {
const docs = MockDocstoreApi.docs[this.example_project_id]
return expect(Object.keys(docs).length).to.equal(2)
})
it('should create one file in the filestore', function() {
it('should create one file in the filestore', function () {
const files = MockFilestoreApi.files[this.example_project_id]
return expect(Object.keys(files).length).to.equal(1)
})
describe('for an existing doc', function() {
describe('trying to add a doc with the same name', function() {
beforeEach(function(done) {
describe('for an existing doc', function () {
describe('trying to add a doc with the same name', function () {
beforeEach(function (done) {
return this.owner.request.post(
{
uri: `/project/${this.example_project_id}/doc`,
@@ -124,13 +124,13 @@ describe('ProjectDuplicateNames', function() {
)
})
it('should respond with 400 error status', function() {
it('should respond with 400 error status', function () {
return expect(this.res.statusCode).to.equal(400)
})
})
describe('trying to add a folder with the same name', function() {
beforeEach(function(done) {
describe('trying to add a folder with the same name', function () {
beforeEach(function (done) {
return this.owner.request.post(
{
uri: `/project/${this.example_project_id}/folder`,
@@ -146,13 +146,13 @@ describe('ProjectDuplicateNames', function() {
)
})
it('should respond with 400 error status', function() {
it('should respond with 400 error status', function () {
return expect(this.res.statusCode).to.equal(400)
})
})
describe('trying to add a folder with the same name', function() {
beforeEach(function(done) {
describe('trying to add a folder with the same name', function () {
beforeEach(function (done) {
return this.owner.request.post(
{
uri: `/project/${this.example_project_id}/folder`,
@@ -168,15 +168,15 @@ describe('ProjectDuplicateNames', function() {
)
})
it('should respond with 400 error status', function() {
it('should respond with 400 error status', function () {
return expect(this.res.statusCode).to.equal(400)
})
})
})
describe('for an existing file', function() {
describe('trying to add a doc with the same name', function() {
beforeEach(function(done) {
describe('for an existing file', function () {
describe('trying to add a doc with the same name', function () {
beforeEach(function (done) {
return this.owner.request.post(
{
uri: `/project/${this.example_project_id}/doc`,
@@ -192,13 +192,13 @@ describe('ProjectDuplicateNames', function() {
)
})
it('should respond with 400 error status', function() {
it('should respond with 400 error status', function () {
return expect(this.res.statusCode).to.equal(400)
})
})
describe('trying to add a folder with the same name', function() {
beforeEach(function(done) {
describe('trying to add a folder with the same name', function () {
beforeEach(function (done) {
return this.owner.request.post(
{
uri: `/project/${this.example_project_id}/folder`,
@@ -214,13 +214,13 @@ describe('ProjectDuplicateNames', function() {
)
})
it('should respond with 400 error status', function() {
it('should respond with 400 error status', function () {
return expect(this.res.statusCode).to.equal(400)
})
})
describe('trying to upload a file with the same name', function() {
beforeEach(function(done) {
describe('trying to upload a file with the same name', function () {
beforeEach(function (done) {
return this.owner.request.post(
{
uri: `/project/${this.example_project_id}/upload`,
@@ -250,16 +250,16 @@ describe('ProjectDuplicateNames', function() {
)
})
it('should succeed (overwriting the file)', function() {
it('should succeed (overwriting the file)', function () {
return expect(this.body.success).to.equal(true)
})
})
})
// at this point the @imageFile._id has changed
describe('for an existing folder', function() {
describe('trying to add a doc with the same name', function() {
beforeEach(function(done) {
describe('for an existing folder', function () {
describe('trying to add a doc with the same name', function () {
beforeEach(function (done) {
return this.owner.request.post(
{
uri: `/project/${this.example_project_id}/doc`,
@@ -275,13 +275,13 @@ describe('ProjectDuplicateNames', function() {
)
})
it('should respond with 400 error status', function() {
it('should respond with 400 error status', function () {
return expect(this.res.statusCode).to.equal(400)
})
})
describe('trying to add a folder with the same name', function() {
beforeEach(function(done) {
describe('trying to add a folder with the same name', function () {
beforeEach(function (done) {
return this.owner.request.post(
{
uri: `/project/${this.example_project_id}/folder`,
@@ -297,13 +297,13 @@ describe('ProjectDuplicateNames', function() {
)
})
it('should respond with 400 error status', function() {
it('should respond with 400 error status', function () {
return expect(this.res.statusCode).to.equal(400)
})
})
describe('trying to upload a file with the same name', function() {
beforeEach(function(done) {
describe('trying to upload a file with the same name', function () {
beforeEach(function (done) {
return this.owner.request.post(
{
uri: `/project/${this.example_project_id}/upload`,
@@ -331,15 +331,15 @@ describe('ProjectDuplicateNames', function() {
)
})
it('should respond with failure status', function() {
it('should respond with failure status', function () {
return expect(this.body.success).to.equal(false)
})
})
})
describe('for an existing doc', function() {
describe('trying to rename a doc to the same name', function() {
beforeEach(function(done) {
describe('for an existing doc', function () {
describe('trying to rename a doc to the same name', function () {
beforeEach(function (done) {
return this.owner.request.post(
{
uri: `/project/${this.example_project_id}/doc/${this.refBibDoc._id}/rename`,
@@ -354,13 +354,13 @@ describe('ProjectDuplicateNames', function() {
)
})
it('should respond with 400 error status', function() {
it('should respond with 400 error status', function () {
return expect(this.res.statusCode).to.equal(400)
})
})
describe('trying to rename a folder to the same name', function() {
beforeEach(function(done) {
describe('trying to rename a folder to the same name', function () {
beforeEach(function (done) {
return this.owner.request.post(
{
uri: `/project/${this.example_project_id}/folder/${this.testFolderId}/rename`,
@@ -375,13 +375,13 @@ describe('ProjectDuplicateNames', function() {
)
})
it('should respond with 400 error status', function() {
it('should respond with 400 error status', function () {
return expect(this.res.statusCode).to.equal(400)
})
})
describe('trying to rename a file to the same name', function() {
beforeEach(function(done) {
describe('trying to rename a file to the same name', function () {
beforeEach(function (done) {
return this.owner.request.post(
{
uri: `/project/${this.example_project_id}/file/${this.imageFile._id}/rename`,
@@ -396,15 +396,15 @@ describe('ProjectDuplicateNames', function() {
)
})
it('should respond with failure status', function() {
it('should respond with failure status', function () {
return expect(this.res.statusCode).to.equal(400)
})
})
})
describe('for an existing file', function() {
describe('trying to rename a doc to the same name', function() {
beforeEach(function(done) {
describe('for an existing file', function () {
describe('trying to rename a doc to the same name', function () {
beforeEach(function (done) {
return this.owner.request.post(
{
uri: `/project/${this.example_project_id}/doc/${this.refBibDoc._id}/rename`,
@@ -419,13 +419,13 @@ describe('ProjectDuplicateNames', function() {
)
})
it('should respond with 400 error status', function() {
it('should respond with 400 error status', function () {
return expect(this.res.statusCode).to.equal(400)
})
})
describe('trying to rename a folder to the same name', function() {
beforeEach(function(done) {
describe('trying to rename a folder to the same name', function () {
beforeEach(function (done) {
return this.owner.request.post(
{
uri: `/project/${this.example_project_id}/folder/${this.testFolderId}/rename`,
@@ -440,13 +440,13 @@ describe('ProjectDuplicateNames', function() {
)
})
it('should respond with 400 error status', function() {
it('should respond with 400 error status', function () {
return expect(this.res.statusCode).to.equal(400)
})
})
describe('trying to rename a file to the same name', function() {
beforeEach(function(done) {
describe('trying to rename a file to the same name', function () {
beforeEach(function (done) {
return this.owner.request.post(
{
uri: `/project/${this.example_project_id}/file/${this.imageFile._id}/rename`,
@@ -461,15 +461,15 @@ describe('ProjectDuplicateNames', function() {
)
})
it('should respond with failure status', function() {
it('should respond with failure status', function () {
return expect(this.res.statusCode).to.equal(400)
})
})
})
describe('for an existing folder', function() {
describe('trying to rename a doc to the same name', function() {
beforeEach(function(done) {
describe('for an existing folder', function () {
describe('trying to rename a doc to the same name', function () {
beforeEach(function (done) {
return this.owner.request.post(
{
uri: `/project/${this.example_project_id}/doc/${this.refBibDoc._id}/rename`,
@@ -484,13 +484,13 @@ describe('ProjectDuplicateNames', function() {
)
})
it('should respond with 400 error status', function() {
it('should respond with 400 error status', function () {
return expect(this.res.statusCode).to.equal(400)
})
})
describe('trying to rename a folder to the same name', function() {
beforeEach(function(done) {
describe('trying to rename a folder to the same name', function () {
beforeEach(function (done) {
return this.owner.request.post(
{
uri: `/project/${this.example_project_id}/folder/${this.testFolderId}/rename`,
@@ -505,13 +505,13 @@ describe('ProjectDuplicateNames', function() {
)
})
it('should respond with 400 error status', function() {
it('should respond with 400 error status', function () {
return expect(this.res.statusCode).to.equal(400)
})
})
describe('trying to rename a file to the same name', function() {
beforeEach(function(done) {
describe('trying to rename a file to the same name', function () {
beforeEach(function (done) {
return this.owner.request.post(
{
uri: `/project/${this.example_project_id}/file/${this.imageFile._id}/rename`,
@@ -526,14 +526,14 @@ describe('ProjectDuplicateNames', function() {
)
})
it('should respond with failure status', function() {
it('should respond with failure status', function () {
return expect(this.res.statusCode).to.equal(400)
})
})
})
describe('for an existing folder with a file with the same name', function() {
beforeEach(function(done) {
describe('for an existing folder with a file with the same name', function () {
beforeEach(function (done) {
return this.owner.request.post(
{
uri: `/project/${this.example_project_id}/doc`,
@@ -583,8 +583,8 @@ describe('ProjectDuplicateNames', function() {
)
})
describe('trying to move a doc into the folder', function() {
beforeEach(function(done) {
describe('trying to move a doc into the folder', function () {
beforeEach(function (done) {
return this.owner.request.post(
{
uri: `/project/${this.example_project_id}/doc/${this.mainTexDoc._id}/move`,
@@ -599,13 +599,13 @@ describe('ProjectDuplicateNames', function() {
)
})
it('should respond with 400 error status', function() {
it('should respond with 400 error status', function () {
return expect(this.res.statusCode).to.equal(400)
})
})
describe('trying to move a file into the folder', function() {
beforeEach(function(done) {
describe('trying to move a file into the folder', function () {
beforeEach(function (done) {
return this.owner.request.post(
{
uri: `/project/${this.example_project_id}/file/${this.imageFile._id}/move`,
@@ -620,13 +620,13 @@ describe('ProjectDuplicateNames', function() {
)
})
it('should respond with 400 error status', function() {
it('should respond with 400 error status', function () {
return expect(this.res.statusCode).to.equal(400)
})
})
describe('trying to move a folder into the folder', function() {
beforeEach(function(done) {
describe('trying to move a folder into the folder', function () {
beforeEach(function (done) {
return this.owner.request.post(
{
uri: `/project/${this.example_project_id}/folder/${this.otherFolderId}/move`,
@@ -641,13 +641,13 @@ describe('ProjectDuplicateNames', function() {
)
})
it('should respond with 400 error status', function() {
it('should respond with 400 error status', function () {
return expect(this.res.statusCode).to.equal(400)
})
})
describe('trying to move a folder into a subfolder of itself', function() {
beforeEach(function(done) {
describe('trying to move a folder into a subfolder of itself', function () {
beforeEach(function (done) {
return this.owner.request.post(
{
uri: `/project/${this.example_project_id}/folder/${this.testFolderId}/move`,
@@ -662,7 +662,7 @@ describe('ProjectDuplicateNames', function() {
)
})
it('should respond with 400 error status', function() {
it('should respond with 400 error status', function () {
return expect(this.res.statusCode).to.equal(400)
})
})