mirror of
https://github.com/actions/checkout.git
synced 2024-12-26 02:53:05 +07:00
813c3f2d82
Co-authored-by: Erez Testiler <easyt@github.com>
34 lines
1.2 KiB
TypeScript
34 lines
1.2 KiB
TypeScript
import * as urlHelper from '../src/url-helper'
|
|
|
|
describe('isGhes tests', () => {
|
|
it('basics', async () => {
|
|
expect(urlHelper.isGhes()).toBeFalsy()
|
|
expect(urlHelper.isGhes('https://github.com')).toBeFalsy()
|
|
//expect(urlHelper.isGhes('https://api.github.com')).toBeFalsy()
|
|
expect(urlHelper.isGhes('https://contoso.ghe.com')).toBeFalsy()
|
|
expect(urlHelper.isGhes('https://test.github.localhost')).toBeFalsy()
|
|
expect(urlHelper.isGhes('https://src.onpremise.customer.com')).toBeTruthy()
|
|
})
|
|
})
|
|
|
|
describe('getServerApiUrl tests', () => {
|
|
it('basics', async () => {
|
|
expect(urlHelper.getServerApiUrl()).toBe('https://api.github.com')
|
|
expect(urlHelper.getServerApiUrl('https://github.com')).toBe(
|
|
'https://api.github.com'
|
|
)
|
|
expect(urlHelper.getServerApiUrl('https://GitHub.com')).toBe(
|
|
'https://api.github.com'
|
|
)
|
|
expect(urlHelper.getServerApiUrl('https://contoso.ghe.com')).toBe(
|
|
'https://api.contoso.ghe.com'
|
|
)
|
|
expect(urlHelper.getServerApiUrl('https://fabrikam.GHE.COM')).toBe(
|
|
'https://api.fabrikam.ghe.com'
|
|
)
|
|
expect(
|
|
urlHelper.getServerApiUrl('https://src.onpremise.customer.com')
|
|
).toBe('https://src.onpremise.customer.com/api/v3')
|
|
})
|
|
})
|