forked from actions/toolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request actions#1735 from kommendorkapten/dynamic-urls
Read the server url from the environment variable.
- Loading branch information
Showing
3 changed files
with
57 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import {signingEndpoints} from '../src/endpoints' | ||
|
||
describe('signingEndpoints', () => { | ||
const originalEnv = process.env | ||
|
||
afterEach(() => { | ||
process.env = originalEnv | ||
}) | ||
|
||
describe('when using github.com', () => { | ||
beforeEach(async () => { | ||
process.env = { | ||
...originalEnv, | ||
GITHUB_SERVER_URL: 'https://github.com' | ||
} | ||
}) | ||
|
||
it('returns expected endpoints', async () => { | ||
const endpoints = signingEndpoints('github') | ||
|
||
expect(endpoints.fulcioURL).toEqual('https://fulcio.githubapp.com') | ||
expect(endpoints.tsaServerURL).toEqual('https://timestamp.githubapp.com') | ||
}) | ||
}) | ||
|
||
describe('when using custom domain', () => { | ||
beforeEach(async () => { | ||
process.env = { | ||
...originalEnv, | ||
GITHUB_SERVER_URL: 'https://foo.bar.com' | ||
} | ||
}) | ||
|
||
it('returns a expected endpoints', async () => { | ||
const endpoints = signingEndpoints('github') | ||
|
||
expect(endpoints.fulcioURL).toEqual('https://fulcio.foo.bar.com') | ||
expect(endpoints.tsaServerURL).toEqual('https://timestamp.foo.bar.com') | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters