2024-01-30 21:55:50 +00:00
|
|
|
import * as config from '../src/internal/shared/config'
|
|
|
|
|
|
|
|
beforeEach(() => {
|
2024-01-31 16:51:04 +00:00
|
|
|
jest.resetModules()
|
|
|
|
})
|
2024-01-30 21:55:50 +00:00
|
|
|
|
|
|
|
describe('isGhes', () => {
|
2024-01-31 16:51:04 +00:00
|
|
|
it('should return false when the request domain is github.com', () => {
|
|
|
|
process.env.GITHUB_SERVER_URL = 'https://github.com'
|
|
|
|
expect(config.isGhes()).toBe(false)
|
|
|
|
})
|
2024-01-30 21:55:50 +00:00
|
|
|
|
2024-01-31 16:51:04 +00:00
|
|
|
it('should return false when the request domain ends with ghe.com', () => {
|
|
|
|
process.env.GITHUB_SERVER_URL = 'https://my.domain.ghe.com'
|
|
|
|
expect(config.isGhes()).toBe(false)
|
|
|
|
})
|
2024-01-30 21:55:50 +00:00
|
|
|
|
2024-01-31 16:51:04 +00:00
|
|
|
it('should return false when the request domain ends with ghe.localhost', () => {
|
|
|
|
process.env.GITHUB_SERVER_URL = 'https://my.domain.ghe.localhost'
|
|
|
|
expect(config.isGhes()).toBe(false)
|
|
|
|
})
|
2024-01-30 21:55:50 +00:00
|
|
|
|
2024-07-03 16:55:53 +00:00
|
|
|
it('should return false when the request domain ends with .localhost', () => {
|
|
|
|
process.env.GITHUB_SERVER_URL = 'https://github.localhost'
|
|
|
|
expect(config.isGhes()).toBe(false)
|
|
|
|
})
|
|
|
|
|
2024-01-31 16:51:04 +00:00
|
|
|
it('should return false when the request domain is specific to an enterprise', () => {
|
|
|
|
process.env.GITHUB_SERVER_URL = 'https://my-enterprise.github.com'
|
|
|
|
expect(config.isGhes()).toBe(true)
|
|
|
|
})
|
|
|
|
})
|