Commit
updating alowed hosts in artifact ghes check using dot prepend ghe host
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import * as config from '../src/internal/shared/config' | ||
|
||
|
||
Check failure on line 3 in packages/artifact/__tests__/config.test.ts GitHub Actions / Build (ubuntu-latest)
Check failure on line 3 in packages/artifact/__tests__/config.test.ts GitHub Actions / Build (macos-latest)
|
||
beforeEach(() => { | ||
jest.resetModules() | ||
Check failure on line 5 in packages/artifact/__tests__/config.test.ts GitHub Actions / Build (ubuntu-latest)
Check failure on line 5 in packages/artifact/__tests__/config.test.ts GitHub Actions / Build (macos-latest)
|
||
}); | ||
Check failure on line 6 in packages/artifact/__tests__/config.test.ts GitHub Actions / Build (ubuntu-latest)
Check failure on line 6 in packages/artifact/__tests__/config.test.ts GitHub Actions / Build (ubuntu-latest)
Check failure on line 6 in packages/artifact/__tests__/config.test.ts GitHub Actions / Build (macos-latest)
Check failure on line 6 in packages/artifact/__tests__/config.test.ts GitHub Actions / Build (macos-latest)
Check failure on line 6 in packages/artifact/__tests__/config.test.ts GitHub Actions / Build (windows-latest)
|
||
|
||
|
||
describe('isGhes', () => { | ||
it('should return false when the request domain is github.com', () => { | ||
Check failure on line 10 in packages/artifact/__tests__/config.test.ts GitHub Actions / Build (ubuntu-latest)
Check failure on line 10 in packages/artifact/__tests__/config.test.ts GitHub Actions / Build (macos-latest)
|
||
process.env.GITHUB_SERVER_URL = 'https://github.com' | ||
Check failure on line 11 in packages/artifact/__tests__/config.test.ts GitHub Actions / Build (ubuntu-latest)
Check failure on line 11 in packages/artifact/__tests__/config.test.ts GitHub Actions / Build (macos-latest)
|
||
expect(config.isGhes()).toBe(false) | ||
Check failure on line 12 in packages/artifact/__tests__/config.test.ts GitHub Actions / Build (ubuntu-latest)
Check failure on line 12 in packages/artifact/__tests__/config.test.ts GitHub Actions / Build (macos-latest)
|
||
}) | ||
Check failure on line 13 in packages/artifact/__tests__/config.test.ts GitHub Actions / Build (ubuntu-latest)
Check failure on line 13 in packages/artifact/__tests__/config.test.ts GitHub Actions / Build (macos-latest)
|
||
|
||
it('should return false when the request domain ends with ghe.com', () => { | ||
Check failure on line 15 in packages/artifact/__tests__/config.test.ts GitHub Actions / Build (ubuntu-latest)
Check failure on line 15 in packages/artifact/__tests__/config.test.ts GitHub Actions / Build (macos-latest)
|
||
process.env.GITHUB_SERVER_URL = 'https://my.domain.ghe.com' | ||
Check failure on line 16 in packages/artifact/__tests__/config.test.ts GitHub Actions / Build (ubuntu-latest)
Check failure on line 16 in packages/artifact/__tests__/config.test.ts GitHub Actions / Build (macos-latest)
|
||
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) | ||
}) | ||
}) |