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
@@ -20,8 +20,8 @@ const modulePath = path.join(
)
const { expect } = require('chai')
describe('ChatApiHandler', function() {
beforeEach(function() {
describe('ChatApiHandler', function () {
beforeEach(function () {
this.settings = {
apis: {
chat: {
@@ -42,9 +42,9 @@ describe('ChatApiHandler', function() {
return (this.callback = sinon.stub())
})
describe('sendGlobalMessage', function() {
describe('successfully', function() {
beforeEach(function() {
describe('sendGlobalMessage', function () {
describe('successfully', function () {
beforeEach(function () {
this.message = { mock: 'message' }
this.request.callsArgWith(1, null, { statusCode: 200 }, this.message)
return this.ChatApiHandler.sendGlobalMessage(
@@ -55,7 +55,7 @@ describe('ChatApiHandler', function() {
)
})
it('should post the data to the chat api', function() {
it('should post the data to the chat api', function () {
return this.request
.calledWith({
url: `${this.settings.apis.chat.internal_url}/project/${this.project_id}/messages`,
@@ -68,13 +68,13 @@ describe('ChatApiHandler', function() {
.should.equal(true)
})
it('should return the message from the post', function() {
it('should return the message from the post', function () {
return this.callback.calledWith(null, this.message).should.equal(true)
})
})
describe('with a non-success status code', function() {
beforeEach(function() {
describe('with a non-success status code', function () {
beforeEach(function () {
this.request.callsArgWith(1, null, { statusCode: 500 })
return this.ChatApiHandler.sendGlobalMessage(
this.project_id,
@@ -84,7 +84,7 @@ describe('ChatApiHandler', function() {
)
})
it('should return an error', function() {
it('should return an error', function () {
expect(this.callback).to.have.been.calledWith(
sinon.match.instanceOf(Error).and(sinon.match.has('statusCode', 500))
)
@@ -92,15 +92,15 @@ describe('ChatApiHandler', function() {
})
})
describe('getGlobalMessages', function() {
beforeEach(function() {
describe('getGlobalMessages', function () {
beforeEach(function () {
this.messages = [{ mock: 'message' }]
this.limit = 30
return (this.before = '1234')
})
describe('successfully', function() {
beforeEach(function() {
describe('successfully', function () {
beforeEach(function () {
this.request.callsArgWith(1, null, { statusCode: 200 }, this.messages)
return this.ChatApiHandler.getGlobalMessages(
this.project_id,
@@ -110,7 +110,7 @@ describe('ChatApiHandler', function() {
)
})
it('should make get request for room to chat api', function() {
it('should make get request for room to chat api', function () {
return this.request
.calledWith({
method: 'GET',
@@ -124,13 +124,13 @@ describe('ChatApiHandler', function() {
.should.equal(true)
})
it('should return the messages from the request', function() {
it('should return the messages from the request', function () {
return this.callback.calledWith(null, this.messages).should.equal(true)
})
})
describe('with failure error code', function() {
beforeEach(function() {
describe('with failure error code', function () {
beforeEach(function () {
this.request.callsArgWith(1, null, { statusCode: 500 }, null)
return this.ChatApiHandler.getGlobalMessages(
this.project_id,
@@ -140,7 +140,7 @@ describe('ChatApiHandler', function() {
)
})
it('should return an error', function() {
it('should return an error', function () {
expect(this.callback).to.have.been.calledWith(
sinon.match.instanceOf(Error).and(sinon.match.has('statusCode', 500))
)
@@ -22,8 +22,8 @@ const modulePath = path.join(
)
const { expect } = require('chai')
describe('ChatController', function() {
beforeEach(function() {
describe('ChatController', function () {
beforeEach(function () {
this.user_id = 'mock-user-id'
this.settings = {}
this.ChatApiHandler = {}
@@ -54,8 +54,8 @@ describe('ChatController', function() {
}
})
describe('sendMessage', function() {
beforeEach(function() {
describe('sendMessage', function () {
beforeEach(function () {
this.req.body = { content: (this.content = 'message-content') }
this.UserInfoManager.getPersonalInfo = sinon
.stub()
@@ -72,38 +72,38 @@ describe('ChatController', function() {
return this.ChatController.sendMessage(this.req, this.res)
})
it('should look up the user', function() {
it('should look up the user', function () {
return this.UserInfoManager.getPersonalInfo
.calledWith(this.user_id)
.should.equal(true)
})
it('should format and inject the user into the message', function() {
it('should format and inject the user into the message', function () {
this.UserInfoController.formatPersonalInfo
.calledWith(this.user)
.should.equal(true)
return this.message.user.should.deep.equal(this.formatted_user)
})
it('should tell the chat handler about the message', function() {
it('should tell the chat handler about the message', function () {
return this.ChatApiHandler.sendGlobalMessage
.calledWith(this.project_id, this.user_id, this.content)
.should.equal(true)
})
it('should tell the editor real time controller about the update with the data from the chat handler', function() {
it('should tell the editor real time controller about the update with the data from the chat handler', function () {
return this.EditorRealTimeController.emitToRoom
.calledWith(this.project_id, 'new-chat-message', this.message)
.should.equal(true)
})
it('should return a 204 status code', function() {
it('should return a 204 status code', function () {
return this.res.sendStatus.calledWith(204).should.equal(true)
})
})
describe('getMessages', function() {
beforeEach(function() {
describe('getMessages', function () {
beforeEach(function () {
this.req.query = {
limit: (this.limit = '30'),
before: (this.before = '12345')
@@ -115,19 +115,19 @@ describe('ChatController', function() {
return this.ChatController.getMessages(this.req, this.res)
})
it('should ask the chat handler about the request', function() {
it('should ask the chat handler about the request', function () {
return this.ChatApiHandler.getGlobalMessages
.calledWith(this.project_id, this.limit, this.before)
.should.equal(true)
})
it('should return the messages', function() {
it('should return the messages', function () {
return this.res.json.calledWith(this.messages).should.equal(true)
})
})
describe('_injectUserInfoIntoThreads', function() {
beforeEach(function() {
describe('_injectUserInfoIntoThreads', function () {
beforeEach(function () {
this.users = {
user_id_1: {
mock: 'user_1'
@@ -145,7 +145,7 @@ describe('ChatController', function() {
}))
})
it('should inject a user object into messaged and resolved data', function(done) {
it('should inject a user object into messaged and resolved data', function (done) {
return this.ChatController._injectUserInfoIntoThreads(
{
thread1: {
@@ -205,7 +205,7 @@ describe('ChatController', function() {
)
})
it('should only need to look up each user once', function(done) {
it('should only need to look up each user once', function (done) {
return this.ChatController._injectUserInfoIntoThreads(
[
{