mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-25 02:00:10 +02:00
Merge pull request #3495 from overleaf/ae-prettier-2
Upgrade Prettier to v2 GitOrigin-RevId: 85aa3fa1acb6332c4f58c46165a43d1a51471f33
This commit is contained in:
@@ -7,8 +7,8 @@ const modulePath = path.join(
|
||||
'../../../../app/src/Features/BetaProgram/BetaProgramController'
|
||||
)
|
||||
|
||||
describe('BetaProgramController', function() {
|
||||
beforeEach(function() {
|
||||
describe('BetaProgramController', function () {
|
||||
beforeEach(function () {
|
||||
this.user = {
|
||||
_id: (this.user_id = 'a_simple_id'),
|
||||
email: 'user@example.com',
|
||||
@@ -46,38 +46,38 @@ describe('BetaProgramController', function() {
|
||||
this.next = sinon.stub()
|
||||
})
|
||||
|
||||
describe('optIn', function() {
|
||||
beforeEach(function() {
|
||||
describe('optIn', function () {
|
||||
beforeEach(function () {
|
||||
this.BetaProgramHandler.optIn.callsArgWith(1, null)
|
||||
})
|
||||
|
||||
it("should redirect to '/beta/participate'", function() {
|
||||
it("should redirect to '/beta/participate'", function () {
|
||||
this.BetaProgramController.optIn(this.req, this.res, this.next)
|
||||
this.res.redirect.callCount.should.equal(1)
|
||||
this.res.redirect.firstCall.args[0].should.equal('/beta/participate')
|
||||
})
|
||||
|
||||
it('should not call next with an error', function() {
|
||||
it('should not call next with an error', function () {
|
||||
this.BetaProgramController.optIn(this.req, this.res, this.next)
|
||||
this.next.callCount.should.equal(0)
|
||||
})
|
||||
|
||||
it('should call BetaProgramHandler.optIn', function() {
|
||||
it('should call BetaProgramHandler.optIn', function () {
|
||||
this.BetaProgramController.optIn(this.req, this.res, this.next)
|
||||
this.BetaProgramHandler.optIn.callCount.should.equal(1)
|
||||
})
|
||||
|
||||
describe('when BetaProgramHandler.opIn produces an error', function() {
|
||||
beforeEach(function() {
|
||||
describe('when BetaProgramHandler.opIn produces an error', function () {
|
||||
beforeEach(function () {
|
||||
this.BetaProgramHandler.optIn.callsArgWith(1, new Error('woops'))
|
||||
})
|
||||
|
||||
it("should not redirect to '/beta/participate'", function() {
|
||||
it("should not redirect to '/beta/participate'", function () {
|
||||
this.BetaProgramController.optIn(this.req, this.res, this.next)
|
||||
this.res.redirect.callCount.should.equal(0)
|
||||
})
|
||||
|
||||
it('should produce an error', function() {
|
||||
it('should produce an error', function () {
|
||||
this.BetaProgramController.optIn(this.req, this.res, this.next)
|
||||
this.next.callCount.should.equal(1)
|
||||
this.next.firstCall.args[0].should.be.instanceof(Error)
|
||||
@@ -85,38 +85,38 @@ describe('BetaProgramController', function() {
|
||||
})
|
||||
})
|
||||
|
||||
describe('optOut', function() {
|
||||
beforeEach(function() {
|
||||
describe('optOut', function () {
|
||||
beforeEach(function () {
|
||||
this.BetaProgramHandler.optOut.callsArgWith(1, null)
|
||||
})
|
||||
|
||||
it("should redirect to '/beta/participate'", function() {
|
||||
it("should redirect to '/beta/participate'", function () {
|
||||
this.BetaProgramController.optOut(this.req, this.res, this.next)
|
||||
this.res.redirect.callCount.should.equal(1)
|
||||
this.res.redirect.firstCall.args[0].should.equal('/beta/participate')
|
||||
})
|
||||
|
||||
it('should not call next with an error', function() {
|
||||
it('should not call next with an error', function () {
|
||||
this.BetaProgramController.optOut(this.req, this.res, this.next)
|
||||
this.next.callCount.should.equal(0)
|
||||
})
|
||||
|
||||
it('should call BetaProgramHandler.optOut', function() {
|
||||
it('should call BetaProgramHandler.optOut', function () {
|
||||
this.BetaProgramController.optOut(this.req, this.res, this.next)
|
||||
this.BetaProgramHandler.optOut.callCount.should.equal(1)
|
||||
})
|
||||
|
||||
describe('when BetaProgramHandler.optOut produces an error', function() {
|
||||
beforeEach(function() {
|
||||
describe('when BetaProgramHandler.optOut produces an error', function () {
|
||||
beforeEach(function () {
|
||||
this.BetaProgramHandler.optOut.callsArgWith(1, new Error('woops'))
|
||||
})
|
||||
|
||||
it("should not redirect to '/beta/participate'", function() {
|
||||
it("should not redirect to '/beta/participate'", function () {
|
||||
this.BetaProgramController.optOut(this.req, this.res, this.next)
|
||||
this.res.redirect.callCount.should.equal(0)
|
||||
})
|
||||
|
||||
it('should produce an error', function() {
|
||||
it('should produce an error', function () {
|
||||
this.BetaProgramController.optOut(this.req, this.res, this.next)
|
||||
this.next.callCount.should.equal(1)
|
||||
this.next.firstCall.args[0].should.be.instanceof(Error)
|
||||
@@ -124,29 +124,29 @@ describe('BetaProgramController', function() {
|
||||
})
|
||||
})
|
||||
|
||||
describe('optInPage', function() {
|
||||
beforeEach(function() {
|
||||
describe('optInPage', function () {
|
||||
beforeEach(function () {
|
||||
this.UserGetter.getUser.callsArgWith(1, null, this.user)
|
||||
})
|
||||
|
||||
it('should render the opt-in page', function() {
|
||||
it('should render the opt-in page', function () {
|
||||
this.BetaProgramController.optInPage(this.req, this.res, this.next)
|
||||
this.res.render.callCount.should.equal(1)
|
||||
const { args } = this.res.render.firstCall
|
||||
args[0].should.equal('beta_program/opt_in')
|
||||
})
|
||||
|
||||
describe('when UserGetter.getUser produces an error', function() {
|
||||
beforeEach(function() {
|
||||
describe('when UserGetter.getUser produces an error', function () {
|
||||
beforeEach(function () {
|
||||
this.UserGetter.getUser.callsArgWith(1, new Error('woops'))
|
||||
})
|
||||
|
||||
it('should not render the opt-in page', function() {
|
||||
it('should not render the opt-in page', function () {
|
||||
this.BetaProgramController.optInPage(this.req, this.res, this.next)
|
||||
this.res.render.callCount.should.equal(0)
|
||||
})
|
||||
|
||||
it('should produce an error', function() {
|
||||
it('should produce an error', function () {
|
||||
this.BetaProgramController.optInPage(this.req, this.res, this.next)
|
||||
this.next.callCount.should.equal(1)
|
||||
this.next.firstCall.args[0].should.be.instanceof(Error)
|
||||
|
||||
@@ -7,8 +7,8 @@ const modulePath = path.join(
|
||||
const sinon = require('sinon')
|
||||
const { expect } = require('chai')
|
||||
|
||||
describe('BetaProgramHandler', function() {
|
||||
beforeEach(function() {
|
||||
describe('BetaProgramHandler', function () {
|
||||
beforeEach(function () {
|
||||
this.user_id = 'some_id'
|
||||
this.user = {
|
||||
_id: this.user_id,
|
||||
@@ -31,15 +31,15 @@ describe('BetaProgramHandler', function() {
|
||||
})
|
||||
})
|
||||
|
||||
describe('optIn', function() {
|
||||
beforeEach(function() {
|
||||
describe('optIn', function () {
|
||||
beforeEach(function () {
|
||||
this.user.betaProgram = false
|
||||
this.call = callback => {
|
||||
this.handler.optIn(this.user_id, callback)
|
||||
}
|
||||
})
|
||||
|
||||
it('should call userUpdater', function(done) {
|
||||
it('should call userUpdater', function (done) {
|
||||
this.call(err => {
|
||||
expect(err).to.not.exist
|
||||
this.UserUpdater.promises.updateUser.callCount.should.equal(1)
|
||||
@@ -47,19 +47,19 @@ describe('BetaProgramHandler', function() {
|
||||
})
|
||||
})
|
||||
|
||||
it('should not produce an error', function(done) {
|
||||
it('should not produce an error', function (done) {
|
||||
this.call(err => {
|
||||
expect(err).to.not.exist
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
describe('when userUpdater produces an error', function() {
|
||||
beforeEach(function() {
|
||||
describe('when userUpdater produces an error', function () {
|
||||
beforeEach(function () {
|
||||
this.UserUpdater.promises.updateUser.rejects()
|
||||
})
|
||||
|
||||
it('should produce an error', function(done) {
|
||||
it('should produce an error', function (done) {
|
||||
this.call(err => {
|
||||
expect(err).to.exist
|
||||
expect(err).to.be.instanceof(Error)
|
||||
@@ -69,15 +69,15 @@ describe('BetaProgramHandler', function() {
|
||||
})
|
||||
})
|
||||
|
||||
describe('optOut', function() {
|
||||
beforeEach(function() {
|
||||
describe('optOut', function () {
|
||||
beforeEach(function () {
|
||||
this.user.betaProgram = true
|
||||
this.call = callback => {
|
||||
this.handler.optOut(this.user_id, callback)
|
||||
}
|
||||
})
|
||||
|
||||
it('should call userUpdater', function(done) {
|
||||
it('should call userUpdater', function (done) {
|
||||
this.call(err => {
|
||||
expect(err).to.not.exist
|
||||
this.UserUpdater.promises.updateUser.callCount.should.equal(1)
|
||||
@@ -85,19 +85,19 @@ describe('BetaProgramHandler', function() {
|
||||
})
|
||||
})
|
||||
|
||||
it('should not produce an error', function(done) {
|
||||
it('should not produce an error', function (done) {
|
||||
this.call(err => {
|
||||
expect(err).to.not.exist
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
describe('when userUpdater produces an error', function() {
|
||||
beforeEach(function() {
|
||||
describe('when userUpdater produces an error', function () {
|
||||
beforeEach(function () {
|
||||
this.UserUpdater.promises.updateUser.rejects()
|
||||
})
|
||||
|
||||
it('should produce an error', function(done) {
|
||||
it('should produce an error', function (done) {
|
||||
this.call(err => {
|
||||
expect(err).to.exist
|
||||
expect(err).to.be.instanceof(Error)
|
||||
|
||||
Reference in New Issue
Block a user