mirror of
https://github.com/actions/setup-java.git
synced 2025-08-29 07:03:42 +00:00
Fix tests and licences
This commit is contained in:
parent
bb39e340a4
commit
e987e880f9
18 changed files with 49 additions and 103 deletions
|
@ -1,9 +1,5 @@
|
|||
import {GraalVMDistribution} from '../../src/distributions/graalvm/installer';
|
||||
import os from 'os';
|
||||
|
||||
function mockArchitecture(arch: string): NodeJS.Architecture {
|
||||
return arch as NodeJS.Architecture;
|
||||
}
|
||||
import * as core from '@actions/core';
|
||||
import {getDownloadArchiveExtension} from '../../src/util';
|
||||
import {HttpClient} from '@actions/http-client';
|
||||
|
@ -102,31 +98,32 @@ describe('findPackageForDownload', () => {
|
|||
});
|
||||
|
||||
it.each([
|
||||
['amd64', 'x64'],
|
||||
['arm64', 'aarch64']
|
||||
['amd64', ['x64', 'amd64']],
|
||||
['arm64', ['aarch64', 'arm64']]
|
||||
])(
|
||||
'defaults to os.arch(): %s mapped to distro arch: %s',
|
||||
async (osArch: string, distroArch: string) => {
|
||||
jest.spyOn(os, 'arch').mockReturnValue(mockArchitecture(osArch));
|
||||
jest.spyOn(os, 'platform').mockReturnValue('linux');
|
||||
async (osArch: string, distroArchs: string[]) => {
|
||||
jest.spyOn(os, 'arch').mockReturnValue(osArch as ReturnType<typeof os.arch>);
|
||||
|
||||
const version = '21';
|
||||
const distro = new GraalVMDistribution({
|
||||
version,
|
||||
const distribution = new GraalVMDistribution({
|
||||
version: '21',
|
||||
architecture: '', // to get default value
|
||||
packageType: 'jdk',
|
||||
checkLatest: false
|
||||
});
|
||||
|
||||
const osType = distribution.getPlatform();
|
||||
if (osType === 'windows' && distroArch == 'aarch64') {
|
||||
if (osType === 'windows' && distroArchs.includes('aarch64')) {
|
||||
return; // skip, aarch64 is not available for Windows
|
||||
}
|
||||
const archiveType = getDownloadArchiveExtension();
|
||||
const result = await distro['findPackageForDownload'](version);
|
||||
const expectedUrl = `https://download.oracle.com/graalvm/21/latest/graalvm-jdk-21_${osType}-${distroArch}_bin.${archiveType}`;
|
||||
const result = await distribution['findPackageForDownload']('21');
|
||||
|
||||
expect(result.url).toBe(expectedUrl);
|
||||
const expectedUrls = distroArchs.map(distroArch =>
|
||||
`https://download.oracle.com/graalvm/21/latest/graalvm-jdk-21_${osType}-${distroArch}_bin.${archiveType}`
|
||||
);
|
||||
|
||||
expect(expectedUrls).toContain(result.url);
|
||||
}
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue