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
@@ -4,8 +4,8 @@ const { assert } = require('chai')
const modulePath = '../../../../app/src/Features/User/UserCreator.js'
describe('UserCreator', function() {
beforeEach(function() {
describe('UserCreator', function () {
beforeEach(function () {
const self = this
this.user = { _id: '12390i', ace: {} }
this.user.save = sinon.stub().resolves(self.user)
@@ -53,9 +53,9 @@ describe('UserCreator', function() {
this.email = 'bob.oswald@gmail.com'
})
describe('createNewUser', function() {
describe('with callbacks', function() {
it('should take the opts and put them in the model', async function() {
describe('createNewUser', function () {
describe('with callbacks', function () {
it('should take the opts and put them in the model', async function () {
const user = await this.UserCreator.promises.createNewUser({
email: this.email,
holdingAccount: true
@@ -65,7 +65,7 @@ describe('UserCreator', function() {
assert.equal(user.first_name, 'bob.oswald')
})
it('should use the start of the email if the first name is empty string', async function() {
it('should use the start of the email if the first name is empty string', async function () {
const user = await this.UserCreator.promises.createNewUser({
email: this.email,
holdingAccount: true,
@@ -76,7 +76,7 @@ describe('UserCreator', function() {
assert.equal(user.first_name, 'bob.oswald')
})
it('should use the first name if passed', async function() {
it('should use the first name if passed', async function () {
const user = await this.UserCreator.promises.createNewUser({
email: this.email,
holdingAccount: true,
@@ -87,7 +87,7 @@ describe('UserCreator', function() {
assert.equal(user.first_name, 'fiiirstname')
})
it('should use the last name if passed', async function() {
it('should use the last name if passed', async function () {
const user = await this.UserCreator.promises.createNewUser({
email: this.email,
holdingAccount: true,
@@ -98,7 +98,7 @@ describe('UserCreator', function() {
assert.equal(user.last_name, 'lastNammmmeee')
})
it('should set emails attribute', async function() {
it('should set emails attribute', async function () {
const user = await this.UserCreator.promises.createNewUser({
email: this.email
})
@@ -109,9 +109,9 @@ describe('UserCreator', function() {
user.emails[0].reversedHostname.should.equal('moc.liamg')
})
describe('with affiliations feature', function() {
describe('with affiliations feature', function () {
let attributes, user
beforeEach(function() {
beforeEach(function () {
attributes = { email: this.email }
this.Features.hasFeature = sinon
.stub()
@@ -119,16 +119,16 @@ describe('UserCreator', function() {
.returns(true)
})
describe('when v1 affiliations API does not return an error', function() {
beforeEach(async function() {
describe('when v1 affiliations API does not return an error', function () {
beforeEach(async function () {
user = await this.UserCreator.promises.createNewUser(attributes)
})
it('should flag that affiliation is unchecked', function() {
it('should flag that affiliation is unchecked', function () {
user.emails[0].affiliationUnchecked.should.equal(true)
})
it('should try to add affiliation to v1', function() {
it('should try to add affiliation to v1', function () {
sinon.assert.calledOnce(
this.UserUpdater.promises.addAffiliationForNewUser
)
@@ -139,22 +139,22 @@ describe('UserCreator', function() {
)
})
it('should query for updated user data', function() {
it('should query for updated user data', function () {
sinon.assert.calledOnce(this.UserGetter.promises.getUser)
})
})
describe('when v1 affiliations API does return an error', function() {
beforeEach(async function() {
describe('when v1 affiliations API does return an error', function () {
beforeEach(async function () {
this.UserUpdater.promises.addAffiliationForNewUser.rejects()
user = await this.UserCreator.promises.createNewUser(attributes)
})
it('should flag that affiliation is unchecked', function() {
it('should flag that affiliation is unchecked', function () {
user.emails[0].affiliationUnchecked.should.equal(true)
})
it('should try to add affiliation to v1', function() {
it('should try to add affiliation to v1', function () {
sinon.assert.calledOnce(
this.UserUpdater.promises.addAffiliationForNewUser
)
@@ -165,26 +165,26 @@ describe('UserCreator', function() {
)
})
it('should not query for updated user data', function() {
it('should not query for updated user data', function () {
sinon.assert.notCalled(this.UserGetter.promises.getUser)
})
it('should log error', function() {
it('should log error', function () {
sinon.assert.calledOnce(this.logger.error)
})
})
describe('when v1 affiliations API returns an error and requireAffiliation=true', function() {
beforeEach(async function() {
describe('when v1 affiliations API returns an error and requireAffiliation=true', function () {
beforeEach(async function () {
this.UserUpdater.promises.addAffiliationForNewUser.rejects()
user = await this.UserCreator.promises.createNewUser(attributes)
})
it('should flag that affiliation is unchecked', function() {
it('should flag that affiliation is unchecked', function () {
user.emails[0].affiliationUnchecked.should.equal(true)
})
it('should try to add affiliation to v1', function() {
it('should try to add affiliation to v1', function () {
sinon.assert.calledOnce(
this.UserUpdater.promises.addAffiliationForNewUser
)
@@ -195,17 +195,17 @@ describe('UserCreator', function() {
)
})
it('should not query for updated user data', function() {
it('should not query for updated user data', function () {
sinon.assert.notCalled(this.UserGetter.promises.getUser)
})
it('should log error', function() {
it('should log error', function () {
sinon.assert.calledOnce(this.logger.error)
})
})
})
it('should not add affiliation when without affiliation feature', async function() {
it('should not add affiliation when without affiliation feature', async function () {
const attributes = { email: this.email }
await this.UserCreator.promises.createNewUser(attributes)
sinon.assert.notCalled(
@@ -214,8 +214,8 @@ describe('UserCreator', function() {
})
})
describe('with promises', function() {
it('should take the opts and put them in the model', async function() {
describe('with promises', function () {
it('should take the opts and put them in the model', async function () {
const opts = {
email: this.email,
holdingAccount: true
@@ -226,7 +226,7 @@ describe('UserCreator', function() {
assert.equal(user.first_name, 'bob.oswald')
})
it('should add affiliation when with affiliation feature', async function() {
it('should add affiliation when with affiliation feature', async function () {
this.Features.hasFeature = sinon
.stub()
.withArgs('affiliations')
@@ -243,7 +243,7 @@ describe('UserCreator', function() {
)
})
it('should not add affiliation when without affiliation feature', async function() {
it('should not add affiliation when without affiliation feature', async function () {
this.Features.hasFeature = sinon.stub().returns(false)
const attributes = { email: this.email }
await this.UserCreator.promises.createNewUser(attributes)
@@ -252,7 +252,7 @@ describe('UserCreator', function() {
)
})
it('should include SAML provider ID with email', async function() {
it('should include SAML provider ID with email', async function () {
const attributes = {
email: this.email,
samlIdentifiers: [{ email: this.email, providerId: '1' }]
@@ -261,7 +261,7 @@ describe('UserCreator', function() {
assert.equal(user.emails[0].samlProviderId, '1')
})
it('should fire an analytics event on registration', async function() {
it('should fire an analytics event on registration', async function () {
const user = await this.UserCreator.promises.createNewUser({
email: this.email
})
@@ -273,7 +273,7 @@ describe('UserCreator', function() {
)
})
it('should schedule an onboarding email on registration', async function() {
it('should schedule an onboarding email on registration', async function () {
const user = await this.UserCreator.promises.createNewUser({
email: this.email
})