mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-28 19:41:33 +02:00
Merge pull request #3495 from overleaf/ae-prettier-2
Upgrade Prettier to v2 GitOrigin-RevId: 85aa3fa1acb6332c4f58c46165a43d1a51471f33
This commit is contained in:
@@ -20,8 +20,8 @@ const modulePath = path.join(
|
||||
)
|
||||
const { expect } = require('chai')
|
||||
|
||||
describe('UserPagesController', function() {
|
||||
beforeEach(function() {
|
||||
describe('UserPagesController', function () {
|
||||
beforeEach(function () {
|
||||
this.settings = {
|
||||
apis: {
|
||||
v1: {
|
||||
@@ -73,8 +73,8 @@ describe('UserPagesController', function() {
|
||||
return (this.res = {})
|
||||
})
|
||||
|
||||
describe('registerPage', function() {
|
||||
it('should render the register page', function(done) {
|
||||
describe('registerPage', function () {
|
||||
it('should render the register page', function (done) {
|
||||
this.res.render = page => {
|
||||
page.should.equal('user/register')
|
||||
return done()
|
||||
@@ -82,7 +82,7 @@ describe('UserPagesController', function() {
|
||||
return this.UserPagesController.registerPage(this.req, this.res)
|
||||
})
|
||||
|
||||
it('should set sharedProjectData', function(done) {
|
||||
it('should set sharedProjectData', function (done) {
|
||||
this.req.query.project_name = 'myProject'
|
||||
this.req.query.user_first_name = 'user_first_name_here'
|
||||
|
||||
@@ -96,7 +96,7 @@ describe('UserPagesController', function() {
|
||||
return this.UserPagesController.registerPage(this.req, this.res)
|
||||
})
|
||||
|
||||
it('should set newTemplateData', function(done) {
|
||||
it('should set newTemplateData', function (done) {
|
||||
this.req.session.templateData = { templateName: 'templateName' }
|
||||
|
||||
this.res.render = (page, opts) => {
|
||||
@@ -106,7 +106,7 @@ describe('UserPagesController', function() {
|
||||
return this.UserPagesController.registerPage(this.req, this.res)
|
||||
})
|
||||
|
||||
it('should not set the newTemplateData if there is nothing in the session', function(done) {
|
||||
it('should not set the newTemplateData if there is nothing in the session', function (done) {
|
||||
this.res.render = (page, opts) => {
|
||||
assert.equal(opts.newTemplateData.templateName, undefined)
|
||||
return done()
|
||||
@@ -115,8 +115,8 @@ describe('UserPagesController', function() {
|
||||
})
|
||||
})
|
||||
|
||||
describe('loginForm', function() {
|
||||
it('should render the login page', function(done) {
|
||||
describe('loginForm', function () {
|
||||
it('should render the login page', function (done) {
|
||||
this.res.render = page => {
|
||||
page.should.equal('user/login')
|
||||
return done()
|
||||
@@ -124,8 +124,8 @@ describe('UserPagesController', function() {
|
||||
return this.UserPagesController.loginPage(this.req, this.res)
|
||||
})
|
||||
|
||||
describe('when an explicit redirect is set via query string', function() {
|
||||
beforeEach(function() {
|
||||
describe('when an explicit redirect is set via query string', function () {
|
||||
beforeEach(function () {
|
||||
this.AuthenticationController._getRedirectFromSession = sinon
|
||||
.stub()
|
||||
.returns(null)
|
||||
@@ -133,7 +133,7 @@ describe('UserPagesController', function() {
|
||||
return (this.req.query.redir = '/somewhere/in/particular')
|
||||
})
|
||||
|
||||
it('should set a redirect', function(done) {
|
||||
it('should set a redirect', function (done) {
|
||||
this.res.render = page => {
|
||||
this.AuthenticationController.setRedirectInSession.callCount.should.equal(
|
||||
1
|
||||
@@ -148,8 +148,8 @@ describe('UserPagesController', function() {
|
||||
})
|
||||
})
|
||||
|
||||
describe('sessionsPage', function() {
|
||||
beforeEach(function() {
|
||||
describe('sessionsPage', function () {
|
||||
beforeEach(function () {
|
||||
return this.UserSessionsManager.getAllUserSessions.callsArgWith(
|
||||
2,
|
||||
null,
|
||||
@@ -157,15 +157,15 @@ describe('UserPagesController', function() {
|
||||
)
|
||||
})
|
||||
|
||||
it('should render user/sessions', function(done) {
|
||||
this.res.render = function(page) {
|
||||
it('should render user/sessions', function (done) {
|
||||
this.res.render = function (page) {
|
||||
page.should.equal('user/sessions')
|
||||
return done()
|
||||
}
|
||||
return this.UserPagesController.sessionsPage(this.req, this.res)
|
||||
})
|
||||
|
||||
it('should have called getAllUserSessions', function(done) {
|
||||
it('should have called getAllUserSessions', function (done) {
|
||||
this.res.render = page => {
|
||||
this.UserSessionsManager.getAllUserSessions.callCount.should.equal(1)
|
||||
return done()
|
||||
@@ -173,15 +173,15 @@ describe('UserPagesController', function() {
|
||||
return this.UserPagesController.sessionsPage(this.req, this.res)
|
||||
})
|
||||
|
||||
describe('when getAllUserSessions produces an error', function() {
|
||||
beforeEach(function() {
|
||||
describe('when getAllUserSessions produces an error', function () {
|
||||
beforeEach(function () {
|
||||
return this.UserSessionsManager.getAllUserSessions.callsArgWith(
|
||||
2,
|
||||
new Error('woops')
|
||||
)
|
||||
})
|
||||
|
||||
it('should call next with an error', function(done) {
|
||||
it('should call next with an error', function (done) {
|
||||
this.next = err => {
|
||||
assert(err !== null)
|
||||
assert(err instanceof Error)
|
||||
@@ -196,8 +196,8 @@ describe('UserPagesController', function() {
|
||||
})
|
||||
})
|
||||
|
||||
describe('settingsPage', function() {
|
||||
beforeEach(function() {
|
||||
describe('settingsPage', function () {
|
||||
beforeEach(function () {
|
||||
this.request.get = sinon
|
||||
.stub()
|
||||
.callsArgWith(1, null, { statusCode: 200 }, { has_password: true })
|
||||
@@ -206,15 +206,15 @@ describe('UserPagesController', function() {
|
||||
.callsArgWith(1, null, this.user))
|
||||
})
|
||||
|
||||
it('should render user/settings', function(done) {
|
||||
this.res.render = function(page) {
|
||||
it('should render user/settings', function (done) {
|
||||
this.res.render = function (page) {
|
||||
page.should.equal('user/settings')
|
||||
return done()
|
||||
}
|
||||
return this.UserPagesController.settingsPage(this.req, this.res)
|
||||
})
|
||||
|
||||
it('should send user', function(done) {
|
||||
it('should send user', function (done) {
|
||||
this.res.render = (page, opts) => {
|
||||
opts.user.should.equal(this.user)
|
||||
return done()
|
||||
@@ -222,7 +222,7 @@ describe('UserPagesController', function() {
|
||||
return this.UserPagesController.settingsPage(this.req, this.res)
|
||||
})
|
||||
|
||||
it("should set 'shouldAllowEditingDetails' to true", function(done) {
|
||||
it("should set 'shouldAllowEditingDetails' to true", function (done) {
|
||||
this.res.render = (page, opts) => {
|
||||
opts.shouldAllowEditingDetails.should.equal(true)
|
||||
return done()
|
||||
@@ -230,7 +230,7 @@ describe('UserPagesController', function() {
|
||||
return this.UserPagesController.settingsPage(this.req, this.res)
|
||||
})
|
||||
|
||||
it('should restructure thirdPartyIdentifiers data for template use', function(done) {
|
||||
it('should restructure thirdPartyIdentifiers data for template use', function (done) {
|
||||
const expectedResult = {
|
||||
google: 'testId'
|
||||
}
|
||||
@@ -241,16 +241,16 @@ describe('UserPagesController', function() {
|
||||
return this.UserPagesController.settingsPage(this.req, this.res)
|
||||
})
|
||||
|
||||
describe('when ldap.updateUserDetailsOnLogin is true', function() {
|
||||
beforeEach(function() {
|
||||
describe('when ldap.updateUserDetailsOnLogin is true', function () {
|
||||
beforeEach(function () {
|
||||
return (this.settings.ldap = { updateUserDetailsOnLogin: true })
|
||||
})
|
||||
|
||||
afterEach(function() {
|
||||
afterEach(function () {
|
||||
return delete this.settings.ldap
|
||||
})
|
||||
|
||||
it('should set "shouldAllowEditingDetails" to false', function(done) {
|
||||
it('should set "shouldAllowEditingDetails" to false', function (done) {
|
||||
this.res.render = (page, opts) => {
|
||||
opts.shouldAllowEditingDetails.should.equal(false)
|
||||
return done()
|
||||
@@ -259,16 +259,16 @@ describe('UserPagesController', function() {
|
||||
})
|
||||
})
|
||||
|
||||
describe('when saml.updateUserDetailsOnLogin is true', function() {
|
||||
beforeEach(function() {
|
||||
describe('when saml.updateUserDetailsOnLogin is true', function () {
|
||||
beforeEach(function () {
|
||||
return (this.settings.saml = { updateUserDetailsOnLogin: true })
|
||||
})
|
||||
|
||||
afterEach(function() {
|
||||
afterEach(function () {
|
||||
return delete this.settings.saml
|
||||
})
|
||||
|
||||
it('should set "shouldAllowEditingDetails" to false', function(done) {
|
||||
it('should set "shouldAllowEditingDetails" to false', function (done) {
|
||||
this.res.render = (page, opts) => {
|
||||
opts.shouldAllowEditingDetails.should.equal(false)
|
||||
return done()
|
||||
|
||||
Reference in New Issue
Block a user