mirror of
https://github.com/actions/setup-java.git
synced 2026-08-22 16:43:10 +01:00
Make OpenJDK tests platform independent
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 2c93ae0c-bbf5-40f5-bf6e-40168d0e267f
This commit is contained in:
@@ -54,14 +54,19 @@ const archivePage = `
|
||||
function createDistribution(
|
||||
version = '26',
|
||||
architecture = 'x64',
|
||||
packageType = 'jdk'
|
||||
packageType = 'jdk',
|
||||
useFixturePlatform = true
|
||||
) {
|
||||
return new OpenJdkDistribution({
|
||||
const distribution = new OpenJdkDistribution({
|
||||
version,
|
||||
architecture,
|
||||
packageType,
|
||||
checkLatest: false
|
||||
});
|
||||
if (useFixturePlatform) {
|
||||
distribution['getPlatform'] = jest.fn(() => 'linux');
|
||||
}
|
||||
return distribution;
|
||||
}
|
||||
|
||||
describe('OpenJdkDistribution', () => {
|
||||
@@ -170,7 +175,7 @@ describe('OpenJdkDistribution', () => {
|
||||
});
|
||||
|
||||
it('maps supported platforms', () => {
|
||||
const distribution = createDistribution();
|
||||
const distribution = createDistribution('26', 'x64', 'jdk', false);
|
||||
|
||||
expect(distribution['getPlatform']('linux')).toBe('linux');
|
||||
expect(distribution['getPlatform']('darwin')).toBe('macos');
|
||||
|
||||
Reference in New Issue
Block a user