lint fixes
This commit is contained in:
1 parent
db6df55535
commit
32b63ee094
2 files changed
+22
-23
No files matched your search
+19
-21
@@ -1,29 +1,27 @@
|
|||||||
import * as config from '../src/internal/shared/config'
|
import * as config from '../src/internal/shared/config'
|
||||||
|
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
jest.resetModules()
|
jest.resetModules()
|
||||||
});
|
})
|
||||||
|
|
||||||
|
|
||||||
describe('isGhes', () => {
|
describe('isGhes', () => {
|
||||||
it('should return false when the request domain is github.com', () => {
|
it('should return false when the request domain is github.com', () => {
|
||||||
process.env.GITHUB_SERVER_URL = 'https://github.com'
|
process.env.GITHUB_SERVER_URL = 'https://github.com'
|
||||||
expect(config.isGhes()).toBe(false)
|
expect(config.isGhes()).toBe(false)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should return false when the request domain ends with ghe.com', () => {
|
it('should return false when the request domain ends with ghe.com', () => {
|
||||||
process.env.GITHUB_SERVER_URL = 'https://my.domain.ghe.com'
|
process.env.GITHUB_SERVER_URL = 'https://my.domain.ghe.com'
|
||||||
expect(config.isGhes()).toBe(false)
|
expect(config.isGhes()).toBe(false)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should return false when the request domain ends with ghe.localhost', () => {
|
it('should return false when the request domain ends with ghe.localhost', () => {
|
||||||
process.env.GITHUB_SERVER_URL = 'https://my.domain.ghe.localhost'
|
process.env.GITHUB_SERVER_URL = 'https://my.domain.ghe.localhost'
|
||||||
expect(config.isGhes()).toBe(false)
|
expect(config.isGhes()).toBe(false)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should return false when the request domain is specific to an enterprise', () => {
|
it('should return false when the request domain is specific to an enterprise', () => {
|
||||||
process.env.GITHUB_SERVER_URL = 'https://my-enterprise.github.com'
|
process.env.GITHUB_SERVER_URL = 'https://my-enterprise.github.com'
|
||||||
expect(config.isGhes()).toBe(true)
|
expect(config.isGhes()).toBe(true)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -29,8 +29,9 @@ export function isGhes(): boolean {
|
|||||||
)
|
)
|
||||||
|
|
||||||
const hostname = ghUrl.hostname.trimEnd().toUpperCase()
|
const hostname = ghUrl.hostname.trimEnd().toUpperCase()
|
||||||
const isGitHubHost = (hostname == 'GITHUB.COM')
|
const isGitHubHost = hostname === 'GITHUB.COM'
|
||||||
const isGheHost = (hostname.endsWith('.GHE.COM') || hostname.endsWith('.GHE.LOCALHOST'))
|
const isGheHost =
|
||||||
|
hostname.endsWith('.GHE.COM') || hostname.endsWith('.GHE.LOCALHOST')
|
||||||
|
|
||||||
return !isGitHubHost && !isGheHost
|
return !isGitHubHost && !isGheHost
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user