|
@@ -300,6 +300,7 @@ describe('ProjectController', function () {
|
|
|
translate() {},
|
|
translate() {},
|
|
|
},
|
|
},
|
|
|
ip: '192.170.18.1',
|
|
ip: '192.170.18.1',
|
|
|
|
|
+ capabilitySet: new Set(['chat']),
|
|
|
}
|
|
}
|
|
|
this.res = {
|
|
this.res = {
|
|
|
locals: {
|
|
locals: {
|
|
@@ -1085,34 +1086,12 @@ describe('ProjectController', function () {
|
|
|
this.ProjectController.loadEditor(this.req, this.res)
|
|
this.ProjectController.loadEditor(this.req, this.res)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- describe('chatEnabled flag', function () {
|
|
|
|
|
- it('should be set to false when the feature is disabled', function (done) {
|
|
|
|
|
|
|
+ describe('capabilitySet', function () {
|
|
|
|
|
+ it('should be passed as an array when loading the editor', function (done) {
|
|
|
this.Features.hasFeature = sinon.stub().withArgs('chat').returns(false)
|
|
this.Features.hasFeature = sinon.stub().withArgs('chat').returns(false)
|
|
|
|
|
|
|
|
this.res.render = (pageName, opts) => {
|
|
this.res.render = (pageName, opts) => {
|
|
|
- expect(opts.chatEnabled).to.be.false
|
|
|
|
|
- done()
|
|
|
|
|
- }
|
|
|
|
|
- this.ProjectController.loadEditor(this.req, this.res)
|
|
|
|
|
- })
|
|
|
|
|
-
|
|
|
|
|
- it('should be set to false when the feature is enabled but the capability is not available', function (done) {
|
|
|
|
|
- this.Features.hasFeature = sinon.stub().withArgs('chat').returns(false)
|
|
|
|
|
- this.req.capabilitySet = new Set()
|
|
|
|
|
-
|
|
|
|
|
- this.res.render = (pageName, opts) => {
|
|
|
|
|
- expect(opts.chatEnabled).to.be.false
|
|
|
|
|
- done()
|
|
|
|
|
- }
|
|
|
|
|
- this.ProjectController.loadEditor(this.req, this.res)
|
|
|
|
|
- })
|
|
|
|
|
-
|
|
|
|
|
- it('should be set to true when the feature is enabled and the capability is available', function (done) {
|
|
|
|
|
- this.Features.hasFeature = sinon.stub().withArgs('chat').returns(true)
|
|
|
|
|
- this.req.capabilitySet = new Set(['chat'])
|
|
|
|
|
-
|
|
|
|
|
- this.res.render = (pageName, opts) => {
|
|
|
|
|
- expect(opts.chatEnabled).to.be.true
|
|
|
|
|
|
|
+ expect(opts.capabilities).to.deep.equal(['chat'])
|
|
|
done()
|
|
done()
|
|
|
}
|
|
}
|
|
|
this.ProjectController.loadEditor(this.req, this.res)
|
|
this.ProjectController.loadEditor(this.req, this.res)
|