|
@@ -556,53 +556,36 @@ describe('ProjectController', function () {
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
describe('persistent upgrade prompt', function () {
|
|
describe('persistent upgrade prompt', function () {
|
|
|
- describe('if the user has the default variant', function (done) {
|
|
|
|
|
- it('should not show', function (done) {
|
|
|
|
|
- this.res.render = (pageName, opts) => {
|
|
|
|
|
- expect(opts.showToolbarUpgradePrompt).to.equal(false)
|
|
|
|
|
- done()
|
|
|
|
|
- }
|
|
|
|
|
- this.ProjectController.projectListPage(this.req, this.res)
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ it('should show for a user without a subscription or only non-paid affiliations', function (done) {
|
|
|
|
|
+ this.res.render = (pageName, opts) => {
|
|
|
|
|
+ expect(opts.showToolbarUpgradePrompt).to.equal(true)
|
|
|
|
|
+ done()
|
|
|
|
|
+ }
|
|
|
|
|
+ this.ProjectController.projectListPage(this.req, this.res)
|
|
|
})
|
|
})
|
|
|
-
|
|
|
|
|
- describe('if the user has the persistent-upgrade variant', function (done) {
|
|
|
|
|
- beforeEach(function () {
|
|
|
|
|
- this.SplitTestHandler.getAssignment
|
|
|
|
|
- .withArgs(this.req, this.res, 'persistent-upgrade-prompt')
|
|
|
|
|
- .yields(null, { variant: 'persistent-upgrade' })
|
|
|
|
|
- })
|
|
|
|
|
- it('should show for a user without a subscription or only non-paid affiliations', function (done) {
|
|
|
|
|
- this.res.render = (pageName, opts) => {
|
|
|
|
|
- expect(opts.showToolbarUpgradePrompt).to.equal(true)
|
|
|
|
|
- done()
|
|
|
|
|
- }
|
|
|
|
|
- this.ProjectController.projectListPage(this.req, this.res)
|
|
|
|
|
- })
|
|
|
|
|
- it('should not show for a user with a subscription', function (done) {
|
|
|
|
|
- this.LimitationsManager.hasPaidSubscription = sinon
|
|
|
|
|
- .stub()
|
|
|
|
|
- .callsArgWith(1, null, true)
|
|
|
|
|
- this.res.render = (pageName, opts) => {
|
|
|
|
|
- expect(opts.showToolbarUpgradePrompt).to.equal(false)
|
|
|
|
|
- done()
|
|
|
|
|
- }
|
|
|
|
|
- this.ProjectController.projectListPage(this.req, this.res)
|
|
|
|
|
- })
|
|
|
|
|
- it('should not show for a user with an affiliated paid university', function (done) {
|
|
|
|
|
- const emailWithProAffiliation = {
|
|
|
|
|
- email: 'pro@example.com',
|
|
|
|
|
- emailHasInstitutionLicence: true,
|
|
|
|
|
- }
|
|
|
|
|
- this.UserGetter.getUserFullEmails = sinon
|
|
|
|
|
- .stub()
|
|
|
|
|
- .yields(null, [emailWithProAffiliation])
|
|
|
|
|
- this.res.render = (pageName, opts) => {
|
|
|
|
|
- expect(opts.showToolbarUpgradePrompt).to.equal(false)
|
|
|
|
|
- done()
|
|
|
|
|
- }
|
|
|
|
|
- this.ProjectController.projectListPage(this.req, this.res)
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ it('should not show for a user with a subscription', function (done) {
|
|
|
|
|
+ this.LimitationsManager.hasPaidSubscription = sinon
|
|
|
|
|
+ .stub()
|
|
|
|
|
+ .callsArgWith(1, null, true)
|
|
|
|
|
+ this.res.render = (pageName, opts) => {
|
|
|
|
|
+ expect(opts.showToolbarUpgradePrompt).to.equal(false)
|
|
|
|
|
+ done()
|
|
|
|
|
+ }
|
|
|
|
|
+ this.ProjectController.projectListPage(this.req, this.res)
|
|
|
|
|
+ })
|
|
|
|
|
+ it('should not show for a user with an affiliated paid university', function (done) {
|
|
|
|
|
+ const emailWithProAffiliation = {
|
|
|
|
|
+ email: 'pro@example.com',
|
|
|
|
|
+ emailHasInstitutionLicence: true,
|
|
|
|
|
+ }
|
|
|
|
|
+ this.UserGetter.getUserFullEmails = sinon
|
|
|
|
|
+ .stub()
|
|
|
|
|
+ .yields(null, [emailWithProAffiliation])
|
|
|
|
|
+ this.res.render = (pageName, opts) => {
|
|
|
|
|
+ expect(opts.showToolbarUpgradePrompt).to.equal(false)
|
|
|
|
|
+ done()
|
|
|
|
|
+ }
|
|
|
|
|
+ this.ProjectController.projectListPage(this.req, this.res)
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
|
|
|
|
@@ -1509,59 +1492,42 @@ describe('ProjectController', function () {
|
|
|
.stub()
|
|
.stub()
|
|
|
.callsArgWith(1, null, null)
|
|
.callsArgWith(1, null, null)
|
|
|
})
|
|
})
|
|
|
- describe('if the user has the default variant', function (done) {
|
|
|
|
|
- it('should not show', function (done) {
|
|
|
|
|
- this.res.render = (pageName, opts) => {
|
|
|
|
|
- expect(opts.showHeaderUpgradePrompt).to.equal(false)
|
|
|
|
|
- done()
|
|
|
|
|
- }
|
|
|
|
|
- this.ProjectController.loadEditor(this.req, this.res)
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ it('should show for a user without a subscription or only non-paid affiliations', function (done) {
|
|
|
|
|
+ this.res.render = (pageName, opts) => {
|
|
|
|
|
+ expect(opts.showHeaderUpgradePrompt).to.equal(true)
|
|
|
|
|
+ done()
|
|
|
|
|
+ }
|
|
|
|
|
+ this.ProjectController.loadEditor(this.req, this.res)
|
|
|
})
|
|
})
|
|
|
-
|
|
|
|
|
- describe('if the user has the persistent-upgrade variant', function (done) {
|
|
|
|
|
- beforeEach(function () {
|
|
|
|
|
- this.SplitTestHandler.getAssignment
|
|
|
|
|
- .withArgs(this.req, this.res, 'persistent-upgrade-prompt')
|
|
|
|
|
- .yields(null, { variant: 'persistent-upgrade' })
|
|
|
|
|
- })
|
|
|
|
|
- it('should show for a user without a subscription or only non-paid affiliations', function (done) {
|
|
|
|
|
- this.res.render = (pageName, opts) => {
|
|
|
|
|
- expect(opts.showHeaderUpgradePrompt).to.equal(true)
|
|
|
|
|
- done()
|
|
|
|
|
- }
|
|
|
|
|
- this.ProjectController.loadEditor(this.req, this.res)
|
|
|
|
|
- })
|
|
|
|
|
- it('should not show for a user with a personal subscription', function (done) {
|
|
|
|
|
- this.SubscriptionLocator.getUsersSubscription = sinon
|
|
|
|
|
- .stub()
|
|
|
|
|
- .callsArgWith(1, null, {})
|
|
|
|
|
- this.res.render = (pageName, opts) => {
|
|
|
|
|
- expect(opts.showHeaderUpgradePrompt).to.equal(false)
|
|
|
|
|
- done()
|
|
|
|
|
- }
|
|
|
|
|
- this.ProjectController.loadEditor(this.req, this.res)
|
|
|
|
|
- })
|
|
|
|
|
- it('should not show for a user who is a member of a group subscription', function (done) {
|
|
|
|
|
- this.LimitationsManager.userIsMemberOfGroupSubscription = sinon
|
|
|
|
|
- .stub()
|
|
|
|
|
- .callsArgWith(1, null, true)
|
|
|
|
|
- this.res.render = (pageName, opts) => {
|
|
|
|
|
- expect(opts.showHeaderUpgradePrompt).to.equal(false)
|
|
|
|
|
- done()
|
|
|
|
|
- }
|
|
|
|
|
- this.ProjectController.loadEditor(this.req, this.res)
|
|
|
|
|
- })
|
|
|
|
|
- it('should not show for a user with an affiliated paid university', function (done) {
|
|
|
|
|
- this.InstitutionsFeatures.hasLicence = sinon
|
|
|
|
|
- .stub()
|
|
|
|
|
- .callsArgWith(1, null, true)
|
|
|
|
|
- this.res.render = (pageName, opts) => {
|
|
|
|
|
- expect(opts.showHeaderUpgradePrompt).to.equal(false)
|
|
|
|
|
- done()
|
|
|
|
|
- }
|
|
|
|
|
- this.ProjectController.loadEditor(this.req, this.res)
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ it('should not show for a user with a personal subscription', function (done) {
|
|
|
|
|
+ this.SubscriptionLocator.getUsersSubscription = sinon
|
|
|
|
|
+ .stub()
|
|
|
|
|
+ .callsArgWith(1, null, {})
|
|
|
|
|
+ this.res.render = (pageName, opts) => {
|
|
|
|
|
+ expect(opts.showHeaderUpgradePrompt).to.equal(false)
|
|
|
|
|
+ done()
|
|
|
|
|
+ }
|
|
|
|
|
+ this.ProjectController.loadEditor(this.req, this.res)
|
|
|
|
|
+ })
|
|
|
|
|
+ it('should not show for a user who is a member of a group subscription', function (done) {
|
|
|
|
|
+ this.LimitationsManager.userIsMemberOfGroupSubscription = sinon
|
|
|
|
|
+ .stub()
|
|
|
|
|
+ .callsArgWith(1, null, true)
|
|
|
|
|
+ this.res.render = (pageName, opts) => {
|
|
|
|
|
+ expect(opts.showHeaderUpgradePrompt).to.equal(false)
|
|
|
|
|
+ done()
|
|
|
|
|
+ }
|
|
|
|
|
+ this.ProjectController.loadEditor(this.req, this.res)
|
|
|
|
|
+ })
|
|
|
|
|
+ it('should not show for a user with an affiliated paid university', function (done) {
|
|
|
|
|
+ this.InstitutionsFeatures.hasLicence = sinon
|
|
|
|
|
+ .stub()
|
|
|
|
|
+ .callsArgWith(1, null, true)
|
|
|
|
|
+ this.res.render = (pageName, opts) => {
|
|
|
|
|
+ expect(opts.showHeaderUpgradePrompt).to.equal(false)
|
|
|
|
|
+ done()
|
|
|
|
|
+ }
|
|
|
|
|
+ this.ProjectController.loadEditor(this.req, this.res)
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|