mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-03 14:19:01 +02:00
Merge pull request #23972 from overleaf/jdt-grant-assist-via-wf-set-trait
enable granting of premium error assist based on WF entitlement to bu… GitOrigin-RevId: 9d21cf8755c881bdc698c0cf9891076ecefd34eb
This commit is contained in:
committed by
Copybot
parent
7708bd1883
commit
e48be7b195
@@ -1121,6 +1121,44 @@ describe('ProjectController', function () {
|
||||
this.ProjectController.loadEditor(this.req, this.res)
|
||||
})
|
||||
})
|
||||
|
||||
describe('when fetching the users featureSet', function () {
|
||||
beforeEach(function () {
|
||||
this.Modules.promises.hooks.fire = sinon.stub().resolves()
|
||||
this.user.features = {}
|
||||
})
|
||||
|
||||
it('should take into account features overrides from modules', function (done) {
|
||||
// this case occurs when the user has bought the ai bundle on WF, which should include our error assistant
|
||||
const bundleFeatures = { aiErrorAssistant: true }
|
||||
this.user.features = { aiErrorAssistant: false }
|
||||
this.Modules.promises.hooks.fire = sinon
|
||||
.stub()
|
||||
.resolves([bundleFeatures])
|
||||
this.res.render = (pageName, opts) => {
|
||||
expect(opts.user.features).to.deep.equal(bundleFeatures)
|
||||
this.Modules.promises.hooks.fire.should.have.been.calledWith(
|
||||
'getModuleProvidedFeatures',
|
||||
this.user._id
|
||||
)
|
||||
done()
|
||||
}
|
||||
this.ProjectController.loadEditor(this.req, this.res)
|
||||
})
|
||||
|
||||
it('should handle modules not returning any features', function (done) {
|
||||
this.Modules.promises.hooks.fire = sinon.stub().resolves([])
|
||||
this.res.render = (pageName, opts) => {
|
||||
expect(opts.user.features).to.deep.equal({})
|
||||
this.Modules.promises.hooks.fire.should.have.been.calledWith(
|
||||
'getModuleProvidedFeatures',
|
||||
this.user._id
|
||||
)
|
||||
done()
|
||||
}
|
||||
this.ProjectController.loadEditor(this.req, this.res)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('userProjectsJson', function () {
|
||||
|
||||
Reference in New Issue
Block a user