Merge pull request #7593 from overleaf/ta-settings-migration

[SettingsPage] Integration Branch

GitOrigin-RevId: 5a3c26b2a02d716c4ae3981e3f08b811ae307725
This commit is contained in:
Timothée Alby
2022-04-25 08:05:12 +00:00
committed by Copybot
parent 35480a3c7d
commit cf2dfc6bf1
83 changed files with 3795 additions and 399 deletions
@@ -43,9 +43,16 @@ describe('UserPagesController', function () {
externalUserId: 'testId',
},
],
refProviders: {
mendeley: true,
zotero: true,
},
}
this.UserGetter = { getUser: sinon.stub() }
this.UserGetter = {
getUser: sinon.stub(),
promises: { getUser: sinon.stub() },
}
this.UserSessionsManager = { getAllUserSessions: sinon.stub() }
this.dropboxStatus = {}
this.ErrorController = { notFound: sinon.stub() }
@@ -57,6 +64,11 @@ describe('UserPagesController', function () {
_getRedirectFromSession: sinon.stub(),
setRedirectInSession: sinon.stub(),
}
this.SplitTestHandler = {
promises: {
getAssignment: sinon.stub().resolves({ variant: 'default' }),
},
}
this.UserPagesController = SandboxedModule.require(modulePath, {
requires: {
'@overleaf/settings': this.settings,
@@ -67,6 +79,7 @@ describe('UserPagesController', function () {
this.AuthenticationController,
'../Authentication/SessionManager': this.SessionManager,
request: (this.request = sinon.stub()),
'../SplitTests/SplitTestHandler': this.SplitTestHandler,
},
})
this.req = {
@@ -217,9 +230,7 @@ describe('UserPagesController', function () {
this.request.get = sinon
.stub()
.callsArgWith(1, null, { statusCode: 200 }, { has_password: true })
return (this.UserGetter.getUser = sinon
.stub()
.callsArgWith(1, null, this.user))
this.UserGetter.promises.getUser = sinon.stub().resolves(this.user)
})
it('should render user/settings', function (done) {
@@ -230,6 +241,17 @@ describe('UserPagesController', function () {
return this.UserPagesController.settingsPage(this.req, this.res)
})
it('should render user/settings-react', function (done) {
this.SplitTestHandler.promises.getAssignment = sinon
.stub()
.resolves({ variant: 'react' })
this.res.render = function (page) {
page.should.equal('user/settings-react')
return done()
}
return this.UserPagesController.settingsPage(this.req, this.res)
})
it('should send user', function (done) {
this.res.render = (page, opts) => {
opts.user.should.equal(this.user)