Merge pull request #3495 from overleaf/ae-prettier-2
Upgrade Prettier to v2 GitOrigin-RevId: 85aa3fa1acb6332c4f58c46165a43d1a51471f33
This commit is contained in:
@@ -4,8 +4,8 @@ const SandboxedModule = require('sandboxed-module')
|
||||
|
||||
const MODULE_PATH = '../../../../app/src/Features/Newsletter/NewsletterManager'
|
||||
|
||||
describe('NewsletterManager', function() {
|
||||
beforeEach('setup mocks', function() {
|
||||
describe('NewsletterManager', function () {
|
||||
beforeEach('setup mocks', function () {
|
||||
this.Settings = {
|
||||
mailchimp: {
|
||||
api_key: 'api_key',
|
||||
@@ -42,8 +42,8 @@ describe('NewsletterManager', function() {
|
||||
this.emailHash = 'c02f60ed0ef51818186274e406c9a48f'
|
||||
})
|
||||
|
||||
describe('subscribe', function() {
|
||||
it('calls Mailchimp to subscribe the user', async function() {
|
||||
describe('subscribe', function () {
|
||||
it('calls Mailchimp to subscribe the user', async function () {
|
||||
await this.NewsletterManager.subscribe(this.user)
|
||||
expect(this.mailchimp.put).to.have.been.calledWith(
|
||||
`/lists/list_id/members/${this.emailHash}`,
|
||||
@@ -57,9 +57,9 @@ describe('NewsletterManager', function() {
|
||||
})
|
||||
})
|
||||
|
||||
describe('unsubscribe', function() {
|
||||
describe('when unsubscribing normally', function() {
|
||||
it('calls Mailchimp to unsubscribe the user', async function() {
|
||||
describe('unsubscribe', function () {
|
||||
describe('when unsubscribing normally', function () {
|
||||
it('calls Mailchimp to unsubscribe the user', async function () {
|
||||
await this.NewsletterManager.unsubscribe(this.user)
|
||||
expect(this.mailchimp.patch).to.have.been.calledWith(
|
||||
`/lists/list_id/members/${this.emailHash}`,
|
||||
@@ -70,7 +70,7 @@ describe('NewsletterManager', function() {
|
||||
)
|
||||
})
|
||||
|
||||
it('ignores a Mailchimp error about fake emails', async function() {
|
||||
it('ignores a Mailchimp error about fake emails', async function () {
|
||||
this.mailchimp.patch.rejects(
|
||||
new Error(
|
||||
'overleaf.duck@example.com looks fake or invalid, please enter a real email address'
|
||||
@@ -80,7 +80,7 @@ describe('NewsletterManager', function() {
|
||||
.fulfilled
|
||||
})
|
||||
|
||||
it('rejects on other errors', async function() {
|
||||
it('rejects on other errors', async function () {
|
||||
this.mailchimp.patch.rejects(
|
||||
new Error('something really wrong is happening')
|
||||
)
|
||||
@@ -89,15 +89,15 @@ describe('NewsletterManager', function() {
|
||||
})
|
||||
})
|
||||
|
||||
describe('when deleting', function() {
|
||||
it('calls Mailchimp to delete the user', async function() {
|
||||
describe('when deleting', function () {
|
||||
it('calls Mailchimp to delete the user', async function () {
|
||||
await this.NewsletterManager.unsubscribe(this.user, { delete: true })
|
||||
expect(this.mailchimp.delete).to.have.been.calledWith(
|
||||
`/lists/list_id/members/${this.emailHash}`
|
||||
)
|
||||
})
|
||||
|
||||
it('ignores a Mailchimp error about fake emails', async function() {
|
||||
it('ignores a Mailchimp error about fake emails', async function () {
|
||||
this.mailchimp.delete.rejects(
|
||||
new Error(
|
||||
'overleaf.duck@example.com looks fake or invalid, please enter a real email address'
|
||||
@@ -108,7 +108,7 @@ describe('NewsletterManager', function() {
|
||||
).to.be.fulfilled
|
||||
})
|
||||
|
||||
it('rejects on other errors', async function() {
|
||||
it('rejects on other errors', async function () {
|
||||
this.mailchimp.delete.rejects(
|
||||
new Error('something really wrong is happening')
|
||||
)
|
||||
@@ -119,8 +119,8 @@ describe('NewsletterManager', function() {
|
||||
})
|
||||
})
|
||||
|
||||
describe('changeEmail', function() {
|
||||
it('calls Mailchimp to change the subscriber email', async function() {
|
||||
describe('changeEmail', function () {
|
||||
it('calls Mailchimp to change the subscriber email', async function () {
|
||||
await this.NewsletterManager.changeEmail(
|
||||
this.user,
|
||||
'overleaf.squirrel@example.com'
|
||||
@@ -134,7 +134,7 @@ describe('NewsletterManager', function() {
|
||||
)
|
||||
})
|
||||
|
||||
it('deletes the old email if changing the address fails', async function() {
|
||||
it('deletes the old email if changing the address fails', async function () {
|
||||
this.mailchimp.patch
|
||||
.withArgs(`/lists/list_id/members/${this.emailHash}`, {
|
||||
email_address: 'overleaf.squirrel@example.com',
|
||||
@@ -154,7 +154,7 @@ describe('NewsletterManager', function() {
|
||||
)
|
||||
})
|
||||
|
||||
it('does not reject on non-fatal error ', async function() {
|
||||
it('does not reject on non-fatal error ', async function () {
|
||||
const nonFatalError = new Error('merge fields were invalid')
|
||||
this.mailchimp.patch.rejects(nonFatalError)
|
||||
await expect(
|
||||
@@ -165,7 +165,7 @@ describe('NewsletterManager', function() {
|
||||
).to.be.fulfilled
|
||||
})
|
||||
|
||||
it('rejects on any other error', async function() {
|
||||
it('rejects on any other error', async function () {
|
||||
const fatalError = new Error('fatal error')
|
||||
this.mailchimp.patch.rejects(fatalError)
|
||||
await expect(
|
||||
|
||||
Reference in New Issue
Block a user