1
0
Fork 0
toolkit/packages/artifact/__tests__/config.test.ts

28 lines
901 B
TypeScript
Raw Permalink Normal View History

import * as config from '../src/internal/shared/config'
beforeEach(() => {
2024-01-31 16:51:04 +00:00
jest.resetModules()
})
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-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-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-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)
})
})