2024-01-30 21:55:50 +00:00
|
|
|
import * as config from '../src/internal/shared/config'
|
|
|
|
|
|
|
|
beforeEach(() => {
|
2024-01-31 01:58:42 +00:00
|
|
|
jest.resetModules()
|
|
|
|
})
|
2024-01-30 21:55:50 +00:00
|
|
|
|
|
|
|
describe('isGhes', () => {
|
2024-01-31 01:58:42 +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 01:58:42 +00:00
|
|
|
it('should return false when the request has ACTIONS_RESULTS_URL set', () => {
|
|
|
|
process.env.ACTIONS_RESULTS_URL = 'my.results.url'
|
|
|
|
expect(config.isGhes()).toBe(false)
|
|
|
|
})
|
2024-01-30 21:55:50 +00:00
|
|
|
|
2024-01-31 01:58:42 +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)
|
|
|
|
})
|
|
|
|
})
|