mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-05 05:18:21 +00:00
Ensure that Features.hasFeature returns a boolean (#3796)
GitOrigin-RevId: f3961f032c6c91c29afaf239c291857798dad3ad
This commit is contained in:
parent
15f49994bd
commit
2e305f36bc
2 changed files with 5 additions and 9 deletions
|
@ -52,7 +52,7 @@ const Features = {
|
|||
case 'saml':
|
||||
return Settings.enableSaml
|
||||
case 'link-url':
|
||||
return _.get(Settings, ['apis', 'linkedUrlProxy', 'url'])
|
||||
return !!_.get(Settings, ['apis', 'linkedUrlProxy', 'url'])
|
||||
case 'public-registration':
|
||||
return publicRegistrationModuleAvailable
|
||||
case 'support':
|
||||
|
|
|
@ -57,6 +57,7 @@ describe('Features', function() {
|
|||
expect(this.Features.hasFeature('oauth')).to.be.false
|
||||
expect(this.Features.hasFeature('overleaf-integration')).to.be.false
|
||||
expect(this.Features.hasFeature('references')).to.be.false
|
||||
expect(this.Features.hasFeature('link-url')).to.be.false
|
||||
})
|
||||
it('should return undefined', function() {
|
||||
expect(this.Features.hasFeature('affiliations')).to.be.undefined
|
||||
|
@ -64,7 +65,6 @@ describe('Features', function() {
|
|||
expect(this.Features.hasFeature('github-sync')).to.be.undefined
|
||||
expect(this.Features.hasFeature('git-bridge')).to.be.undefined
|
||||
expect(this.Features.hasFeature('homepage')).to.be.undefined
|
||||
expect(this.Features.hasFeature('link-url')).to.be.undefined
|
||||
expect(this.Features.hasFeature('saml')).to.be.undefined
|
||||
})
|
||||
})
|
||||
|
@ -83,6 +83,7 @@ describe('Features', function() {
|
|||
expect(this.Features.hasFeature('oauth')).to.be.false
|
||||
expect(this.Features.hasFeature('references')).to.be.false
|
||||
expect(this.Features.hasFeature('templates-server-pro')).to.be.false
|
||||
expect(this.Features.hasFeature('link-url')).to.be.false
|
||||
})
|
||||
it('should return undefined', function() {
|
||||
expect(this.Features.hasFeature('affiliations')).to.be.undefined
|
||||
|
@ -90,7 +91,6 @@ describe('Features', function() {
|
|||
expect(this.Features.hasFeature('github-sync')).to.be.undefined
|
||||
expect(this.Features.hasFeature('git-bridge')).to.be.undefined
|
||||
expect(this.Features.hasFeature('homepage')).to.be.undefined
|
||||
expect(this.Features.hasFeature('link-url')).to.be.undefined
|
||||
expect(this.Features.hasFeature('saml')).to.be.undefined
|
||||
})
|
||||
describe('with APIs', function() {
|
||||
|
@ -111,9 +111,7 @@ describe('Features', function() {
|
|||
expect(this.Features.hasFeature('affiliations')).to.be.true
|
||||
expect(this.Features.hasFeature('analytics')).to.be.true
|
||||
expect(this.Features.hasFeature('custom-togglers')).to.be.true
|
||||
expect(this.Features.hasFeature('link-url')).to.equal(
|
||||
'https://www.overleaf.com'
|
||||
)
|
||||
expect(this.Features.hasFeature('link-url')).to.equal(true)
|
||||
expect(this.Features.hasFeature('overleaf-integration')).to.be.true
|
||||
expect(this.Features.hasFeature('references')).to.be.true
|
||||
expect(this.Features.hasFeature('registration')).to.be.true
|
||||
|
@ -143,9 +141,7 @@ describe('Features', function() {
|
|||
expect(this.Features.hasFeature('github-sync')).to.be.true
|
||||
expect(this.Features.hasFeature('git-bridge')).to.be.true
|
||||
expect(this.Features.hasFeature('homepage')).to.be.true
|
||||
expect(this.Features.hasFeature('link-url')).to.equal(
|
||||
'https://www.overleaf.com'
|
||||
)
|
||||
expect(this.Features.hasFeature('link-url')).to.equal(true)
|
||||
expect(this.Features.hasFeature('oauth')).to.be.true
|
||||
expect(this.Features.hasFeature('overleaf-integration')).to.be
|
||||
.true
|
||||
|
|
Loading…
Reference in a new issue