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
@@ -5,11 +5,11 @@ const modulePath = require('path').join(
'../../../../app/src/Features/Notifications/NotificationsBuilder.js'
)
describe('NotificationsBuilder', function() {
describe('NotificationsBuilder', function () {
const userId = '123nd3ijdks'
describe('ipMatcherAffiliation', function() {
beforeEach(function() {
describe('ipMatcherAffiliation', function () {
beforeEach(function () {
this.handler = { createNotification: sinon.stub().callsArgWith(6) }
this.settings = { apis: { v1: { url: 'v1.url', user: '', pass: '' } } }
this.request = sinon.stub()
@@ -22,8 +22,8 @@ describe('NotificationsBuilder', function() {
})
})
describe('with portal and with SSO', function() {
beforeEach(function() {
describe('with portal and with SSO', function () {
beforeEach(function () {
this.body = {
id: 1,
name: 'stanford',
@@ -35,7 +35,7 @@ describe('NotificationsBuilder', function() {
this.request.callsArgWith(1, null, { statusCode: 200 }, this.body)
})
it('should call v1 and create affiliation notifications', function(done) {
it('should call v1 and create affiliation notifications', function (done) {
const ip = '192.168.0.1'
this.controller.ipMatcherAffiliation(userId).create(ip, callback => {
this.request.calledOnce.should.equal(true)
@@ -58,8 +58,8 @@ describe('NotificationsBuilder', function() {
})
})
})
describe('without portal and without SSO', function() {
beforeEach(function() {
describe('without portal and without SSO', function () {
beforeEach(function () {
this.body = {
id: 1,
name: 'stanford',
@@ -71,7 +71,7 @@ describe('NotificationsBuilder', function() {
this.request.callsArgWith(1, null, { statusCode: 200 }, this.body)
})
it('should call v1 and create affiliation notifications', function(done) {
it('should call v1 and create affiliation notifications', function (done) {
const ip = '192.168.0.1'
this.controller.ipMatcherAffiliation(userId).create(ip, callback => {
this.request.calledOnce.should.equal(true)
@@ -19,11 +19,11 @@ const modulePath = require('path').join(
'../../../../app/src/Features/Notifications/NotificationsController.js'
)
describe('NotificationsController', function() {
describe('NotificationsController', function () {
const user_id = '123nd3ijdks'
const notification_id = '123njdskj9jlk'
beforeEach(function() {
beforeEach(function () {
this.handler = {
getUserNotifications: sinon.stub().callsArgWith(1),
markAsRead: sinon.stub().callsArgWith(2)
@@ -53,7 +53,7 @@ describe('NotificationsController', function() {
}))
})
it('should ask the handler for all unread notifications', function(done) {
it('should ask the handler for all unread notifications', function (done) {
const allNotifications = [{ _id: notification_id, user_id }]
this.handler.getUserNotifications = sinon
.stub()
@@ -67,7 +67,7 @@ describe('NotificationsController', function() {
})
})
it('should send a delete request when a delete has been received to mark a notification', function(done) {
it('should send a delete request when a delete has been received to mark a notification', function (done) {
return this.controller.markNotificationAsRead(this.req, {
sendStatus: () => {
this.handler.markAsRead
@@ -21,12 +21,12 @@ const modulePath = require('path').join(
)
const _ = require('underscore')
describe('NotificationsHandler', function() {
describe('NotificationsHandler', function () {
const user_id = '123nd3ijdks'
const notification_id = '123njdskj9jlk'
const notificationUrl = 'notification.sharelatex.testing'
beforeEach(function() {
beforeEach(function () {
this.request = sinon.stub().callsArgWith(1)
return (this.handler = SandboxedModule.require(modulePath, {
requires: {
@@ -38,8 +38,8 @@ describe('NotificationsHandler', function() {
}))
})
describe('getUserNotifications', function() {
it('should get unread notifications', function(done) {
describe('getUserNotifications', function () {
it('should get unread notifications', function (done) {
const stubbedNotifications = [{ _id: notification_id, user_id }]
this.request.callsArgWith(
1,
@@ -63,7 +63,7 @@ describe('NotificationsHandler', function() {
)
})
it('should return empty arrays if there are no notifications', function() {
it('should return empty arrays if there are no notifications', function () {
this.request.callsArgWith(1, null, { statusCode: 200 }, null)
return this.handler.getUserNotifications(
user_id,
@@ -74,12 +74,12 @@ describe('NotificationsHandler', function() {
})
})
describe('markAsRead', function() {
beforeEach(function() {
describe('markAsRead', function () {
beforeEach(function () {
return (this.key = 'some key here')
})
it('should send a delete request when a delete has been received to mark a notification', function(done) {
it('should send a delete request when a delete has been received to mark a notification', function (done) {
return this.handler.markAsReadWithKey(user_id, this.key, () => {
const opts = {
uri: `${notificationUrl}/user/${user_id}`,
@@ -95,15 +95,15 @@ describe('NotificationsHandler', function() {
})
})
describe('createNotification', function() {
beforeEach(function() {
describe('createNotification', function () {
beforeEach(function () {
this.key = 'some key here'
this.messageOpts = { value: 12344 }
this.templateKey = 'renderThisHtml'
return (this.expiry = null)
})
it('should post the message over', function(done) {
it('should post the message over', function (done) {
return this.handler.createNotification(
user_id,
this.key,
@@ -126,15 +126,15 @@ describe('NotificationsHandler', function() {
)
})
describe('when expiry date is supplied', function() {
beforeEach(function() {
describe('when expiry date is supplied', function () {
beforeEach(function () {
this.key = 'some key here'
this.messageOpts = { value: 12344 }
this.templateKey = 'renderThisHtml'
return (this.expiry = new Date())
})
it('should post the message over with expiry field', function(done) {
it('should post the message over with expiry field', function (done) {
return this.handler.createNotification(
user_id,
this.key,
@@ -160,12 +160,12 @@ describe('NotificationsHandler', function() {
})
})
describe('markAsReadByKeyOnly', function() {
beforeEach(function() {
describe('markAsReadByKeyOnly', function () {
beforeEach(function () {
return (this.key = 'some key here')
})
it('should send a delete request when a delete has been received to mark a notification', function(done) {
it('should send a delete request when a delete has been received to mark a notification', function (done) {
return this.handler.markAsReadByKeyOnly(this.key, () => {
const opts = {
uri: `${notificationUrl}/key/${this.key}`,