updating alowed hosts in isGhes check

updating alowed hosts in artifact ghes check

using dot prepend ghe host
This commit is contained in:
eggyhead
2024-01-30 21:55:50 +00:00
parent 1fe633e27c
commit 3b02a6fdc5
4 changed files with 65 additions and 2 deletions

View File

@@ -0,0 +1,29 @@
import * as config from '../src/internal/shared/config'
beforeEach(() => {
jest.resetModules()
});
describe('isGhes', () => {
it('should return false when the request domain is github.com', () => {
process.env.GITHUB_SERVER_URL = 'https://github.com'
expect(config.isGhes()).toBe(false)
})
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)
})
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)
})
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)
})
})