mirror of
https://github.com/actions/setup-java.git
synced 2025-04-21 02:16:45 +00:00
Add check-latest flag (#141)
* add changes for check-latest * run prerelease script * resolving comments * fixing tests * fix spelling * improve core.info messages * run format * run prerelease * change version to fix test * resolve comment for check-latest * Update README.md * added hosted tool cache section * Apply suggestions from code review Co-authored-by: Maxim Lobanov <v-malob@microsoft.com> Co-authored-by: Konrad Pabjan <konradpabjan@github.com>
This commit is contained in:
parent
502a6650cd
commit
022e86d5c9
14 changed files with 279 additions and 77 deletions
|
@ -27,19 +27,19 @@ describe('getAvailableVersions', () => {
|
|||
|
||||
it.each([
|
||||
[
|
||||
{ version: '11', architecture: 'x64', packageType: 'jdk' },
|
||||
{ version: '11', architecture: 'x64', packageType: 'jdk', checkLatest: false },
|
||||
'os=mac&architecture=x64&image_type=jdk&release_type=ga&page_size=20&page=0'
|
||||
],
|
||||
[
|
||||
{ version: '11', architecture: 'x86', packageType: 'jdk' },
|
||||
{ version: '11', architecture: 'x86', packageType: 'jdk', checkLatest: false },
|
||||
'os=mac&architecture=x86&image_type=jdk&release_type=ga&page_size=20&page=0'
|
||||
],
|
||||
[
|
||||
{ version: '11', architecture: 'x64', packageType: 'jre' },
|
||||
{ version: '11', architecture: 'x64', packageType: 'jre', checkLatest: false },
|
||||
'os=mac&architecture=x64&image_type=jre&release_type=ga&page_size=20&page=0'
|
||||
],
|
||||
[
|
||||
{ version: '11-ea', architecture: 'x64', packageType: 'jdk' },
|
||||
{ version: '11-ea', architecture: 'x64', packageType: 'jdk', checkLatest: false },
|
||||
'os=mac&architecture=x64&image_type=jdk&release_type=ea&page_size=20&page=0'
|
||||
]
|
||||
])(
|
||||
|
@ -79,7 +79,8 @@ describe('getAvailableVersions', () => {
|
|||
const distribution = new AdoptDistribution({
|
||||
version: '11',
|
||||
architecture: 'x64',
|
||||
packageType: 'jdk'
|
||||
packageType: 'jdk',
|
||||
checkLatest: false
|
||||
});
|
||||
const availableVersions = await distribution['getAvailableVersions']();
|
||||
expect(availableVersions).not.toBeNull();
|
||||
|
@ -104,7 +105,8 @@ describe('findPackageForDownload', () => {
|
|||
const distribution = new AdoptDistribution({
|
||||
version: '11',
|
||||
architecture: 'x64',
|
||||
packageType: 'jdk'
|
||||
packageType: 'jdk',
|
||||
checkLatest: false
|
||||
});
|
||||
distribution['getAvailableVersions'] = async () => manifestData;
|
||||
const resolvedVersion = await distribution['findPackageForDownload'](input);
|
||||
|
@ -115,7 +117,8 @@ describe('findPackageForDownload', () => {
|
|||
const distribution = new AdoptDistribution({
|
||||
version: '11',
|
||||
architecture: 'x64',
|
||||
packageType: 'jdk'
|
||||
packageType: 'jdk',
|
||||
checkLatest: false
|
||||
});
|
||||
distribution['getAvailableVersions'] = async () => manifestData;
|
||||
await expect(distribution['findPackageForDownload']('9.0.8')).rejects.toThrowError(
|
||||
|
@ -127,7 +130,8 @@ describe('findPackageForDownload', () => {
|
|||
const distribution = new AdoptDistribution({
|
||||
version: '11',
|
||||
architecture: 'x64',
|
||||
packageType: 'jdk'
|
||||
packageType: 'jdk',
|
||||
checkLatest: false
|
||||
});
|
||||
distribution['getAvailableVersions'] = async () => manifestData;
|
||||
await expect(distribution['findPackageForDownload']('7.x')).rejects.toThrowError(
|
||||
|
@ -139,7 +143,8 @@ describe('findPackageForDownload', () => {
|
|||
const distribution = new AdoptDistribution({
|
||||
version: '11',
|
||||
architecture: 'x64',
|
||||
packageType: 'jdk'
|
||||
packageType: 'jdk',
|
||||
checkLatest: false
|
||||
});
|
||||
distribution['getAvailableVersions'] = async () => [];
|
||||
await expect(distribution['findPackageForDownload']('11')).rejects.toThrowError(
|
||||
|
|
|
@ -19,13 +19,13 @@ class EmptyJavaBase extends JavaBase {
|
|||
|
||||
protected async downloadTool(javaRelease: JavaDownloadRelease): Promise<JavaInstallerResults> {
|
||||
return {
|
||||
version: '11.0.8',
|
||||
path: `/toolcache/${this.toolcacheFolderName}/11.0.8/${this.architecture}`
|
||||
version: '11.0.9',
|
||||
path: path.join('toolcache', this.toolcacheFolderName, '11.0.9', this.architecture)
|
||||
};
|
||||
}
|
||||
|
||||
protected async findPackageForDownload(range: string): Promise<JavaDownloadRelease> {
|
||||
const availableVersion = '11.0.8';
|
||||
const availableVersion = '11.0.9';
|
||||
if (!semver.satisfies(availableVersion, range)) {
|
||||
throw new Error('Available version not found');
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ class EmptyJavaBase extends JavaBase {
|
|||
}
|
||||
|
||||
describe('findInToolcache', () => {
|
||||
const actualJavaVersion = '11.1.10';
|
||||
const actualJavaVersion = '11.0.8';
|
||||
const javaPath = path.join('Java_Empty_jdk', actualJavaVersion, 'x64');
|
||||
|
||||
let mockJavaBase: EmptyJavaBase;
|
||||
|
@ -58,21 +58,33 @@ describe('findInToolcache', () => {
|
|||
|
||||
it.each([
|
||||
[
|
||||
{ version: '11', architecture: 'x64', packageType: 'jdk' },
|
||||
{ version: '11', architecture: 'x64', packageType: 'jdk', checkLatest: false },
|
||||
{ version: actualJavaVersion, path: javaPath }
|
||||
],
|
||||
[
|
||||
{ version: '11.1', architecture: 'x64', packageType: 'jdk' },
|
||||
{ version: '11.0', architecture: 'x64', packageType: 'jdk', checkLatest: false },
|
||||
{ version: actualJavaVersion, path: javaPath }
|
||||
],
|
||||
[
|
||||
{ version: '11.1.10', architecture: 'x64', packageType: 'jdk' },
|
||||
{ version: '11.0.8', architecture: 'x64', packageType: 'jdk', checkLatest: false },
|
||||
{ version: actualJavaVersion, path: javaPath }
|
||||
],
|
||||
[{ version: '11', architecture: 'x64', packageType: 'jre' }, null],
|
||||
[{ version: '8', architecture: 'x64', packageType: 'jdk' }, null],
|
||||
[{ version: '11', architecture: 'x86', packageType: 'jdk' }, null],
|
||||
[{ version: '11', architecture: 'x86', packageType: 'jre' }, null]
|
||||
[
|
||||
{ version: '11', architecture: 'x64', packageType: 'jdk', checkLatest: true },
|
||||
{ version: actualJavaVersion, path: javaPath }
|
||||
],
|
||||
[
|
||||
{ version: '11.0', architecture: 'x64', packageType: 'jdk', checkLatest: true },
|
||||
{ version: actualJavaVersion, path: javaPath }
|
||||
],
|
||||
[
|
||||
{ version: '11.0.8', architecture: 'x64', packageType: 'jdk', checkLatest: true },
|
||||
{ version: actualJavaVersion, path: javaPath }
|
||||
],
|
||||
[{ version: '11', architecture: 'x64', packageType: 'jre', checkLatest: false }, null],
|
||||
[{ version: '8', architecture: 'x64', packageType: 'jdk', checkLatest: false }, null],
|
||||
[{ version: '11', architecture: 'x86', packageType: 'jdk', checkLatest: false }, null],
|
||||
[{ version: '11', architecture: 'x86', packageType: 'jre', checkLatest: false }, null]
|
||||
])(`should find java for path %s -> %s`, (input, expected) => {
|
||||
spyTcFindAllVersions.mockReturnValue([actualJavaVersion]);
|
||||
spyGetToolcachePath.mockImplementation(
|
||||
|
@ -115,15 +127,22 @@ describe('findInToolcache', () => {
|
|||
(toolname: string, javaVersion: string, architecture: string) =>
|
||||
`/hostedtoolcache/${toolname}/${javaVersion}/${architecture}`
|
||||
);
|
||||
mockJavaBase = new EmptyJavaBase({ version: input, architecture: 'x64', packageType: 'jdk' });
|
||||
mockJavaBase = new EmptyJavaBase({
|
||||
version: input,
|
||||
architecture: 'x64',
|
||||
packageType: 'jdk',
|
||||
checkLatest: false
|
||||
});
|
||||
const foundVersion = mockJavaBase['findInToolcache']();
|
||||
expect(foundVersion?.version).toEqual(expected);
|
||||
});
|
||||
});
|
||||
|
||||
describe('setupJava', () => {
|
||||
const actualJavaVersion = '11.1.10';
|
||||
const javaPath = path.join('Java_Empty_jdk', actualJavaVersion, 'x86');
|
||||
const actualJavaVersion = '11.0.9';
|
||||
const installedJavaVersion = '11.0.8';
|
||||
const javaPath = path.join('Java_Empty_jdk', installedJavaVersion, 'x86');
|
||||
const javaPathInstalled = path.join('toolcache', 'Java_Empty_jdk', actualJavaVersion, 'x86');
|
||||
|
||||
let mockJavaBase: EmptyJavaBase;
|
||||
|
||||
|
@ -145,12 +164,12 @@ describe('setupJava', () => {
|
|||
return '';
|
||||
}
|
||||
|
||||
return semver.satisfies(actualJavaVersion, semverVersion) ? javaPath : '';
|
||||
return semver.satisfies(installedJavaVersion, semverVersion) ? javaPath : '';
|
||||
}
|
||||
);
|
||||
|
||||
spyTcFindAllVersions = jest.spyOn(tc, 'findAllVersions');
|
||||
spyTcFindAllVersions.mockReturnValue([actualJavaVersion]);
|
||||
spyTcFindAllVersions.mockReturnValue([installedJavaVersion]);
|
||||
|
||||
// Spy on core methods
|
||||
spyCoreDebug = jest.spyOn(core, 'debug');
|
||||
|
@ -177,35 +196,41 @@ describe('setupJava', () => {
|
|||
|
||||
it.each([
|
||||
[
|
||||
{ version: '11', architecture: 'x86', packageType: 'jdk' },
|
||||
{ version: actualJavaVersion, path: javaPath }
|
||||
{ version: '11', architecture: 'x86', packageType: 'jdk', checkLatest: false },
|
||||
{ version: installedJavaVersion, path: javaPath }
|
||||
],
|
||||
[
|
||||
{ version: '11.1', architecture: 'x86', packageType: 'jdk' },
|
||||
{ version: actualJavaVersion, path: javaPath }
|
||||
{ version: '11.0', architecture: 'x86', packageType: 'jdk', checkLatest: false },
|
||||
{ version: installedJavaVersion, path: javaPath }
|
||||
],
|
||||
[
|
||||
{ version: '11.1.10', architecture: 'x86', packageType: 'jdk' },
|
||||
{ version: actualJavaVersion, path: javaPath }
|
||||
{ version: '11.0.8', architecture: 'x86', packageType: 'jdk', checkLatest: false },
|
||||
{ version: installedJavaVersion, path: javaPath }
|
||||
]
|
||||
])('should find java locally for %s', (input, expected) => {
|
||||
mockJavaBase = new EmptyJavaBase(input);
|
||||
expect(mockJavaBase.setupJava()).resolves.toEqual(expected);
|
||||
expect(spyGetToolcachePath).toHaveBeenCalled();
|
||||
expect(spyCoreInfo).toHaveBeenCalledWith(`Resolved Java ${expected.version} from tool-cache`);
|
||||
expect(spyCoreInfo).toHaveBeenCalledWith(`Setting Java ${expected.version} as the default`);
|
||||
expect(spyCoreInfo).not.toHaveBeenCalledWith(
|
||||
'Trying to resolve the latest version from remote'
|
||||
);
|
||||
expect(spyCoreInfo).not.toHaveBeenCalledWith('Trying to download...');
|
||||
});
|
||||
|
||||
it.each([
|
||||
[
|
||||
{ version: '11', architecture: 'x86', packageType: 'jre' },
|
||||
{ path: `/toolcache/Java_Empty_jre/11.0.8/x86`, version: '11.0.8' }
|
||||
{ version: '11', architecture: 'x86', packageType: 'jre', checkLatest: false },
|
||||
{ path: path.join('toolcache', 'Java_Empty_jre', '11.0.9', 'x86'), version: '11.0.9' }
|
||||
],
|
||||
[
|
||||
{ version: '11', architecture: 'x64', packageType: 'jdk' },
|
||||
{ path: `/toolcache/Java_Empty_jdk/11.0.8/x64`, version: '11.0.8' }
|
||||
{ version: '11', architecture: 'x64', packageType: 'jdk', checkLatest: false },
|
||||
{ path: path.join('toolcache', 'Java_Empty_jdk', '11.0.9', 'x64'), version: '11.0.9' }
|
||||
],
|
||||
[
|
||||
{ version: '11', architecture: 'x64', packageType: 'jre' },
|
||||
{ path: `/toolcache/Java_Empty_jre/11.0.8/x64`, version: '11.0.8' }
|
||||
{ version: '11', architecture: 'x64', packageType: 'jre', checkLatest: false },
|
||||
{ path: path.join('toolcache', 'Java_Empty_jre', '11.0.9', 'x64'), version: '11.0.9' }
|
||||
]
|
||||
])('download java with configuration %s', async (input, expected) => {
|
||||
mockJavaBase = new EmptyJavaBase(input);
|
||||
|
@ -214,11 +239,55 @@ describe('setupJava', () => {
|
|||
expect(spyCoreAddPath).toHaveBeenCalled();
|
||||
expect(spyCoreExportVariable).toHaveBeenCalled();
|
||||
expect(spyCoreSetOutput).toHaveBeenCalled();
|
||||
expect(spyCoreInfo).toHaveBeenCalledWith('Trying to resolve the latest version from remote');
|
||||
expect(spyCoreInfo).toHaveBeenCalledWith(`Resolved latest version as ${expected.version}`);
|
||||
expect(spyCoreInfo).toHaveBeenCalledWith('Trying to download...');
|
||||
expect(spyCoreInfo).toHaveBeenCalledWith(`Java ${expected.version} was downloaded`);
|
||||
expect(spyCoreInfo).toHaveBeenCalledWith(`Setting Java ${expected.version} as the default`);
|
||||
});
|
||||
|
||||
it.each([
|
||||
[{ version: '15', architecture: 'x86', packageType: 'jre' }],
|
||||
[{ version: '11.0.7', architecture: 'x64', packageType: 'jre' }]
|
||||
[
|
||||
{ version: '11.0.9', architecture: 'x86', packageType: 'jdk', checkLatest: true },
|
||||
{ version: '11.0.9', path: javaPathInstalled }
|
||||
]
|
||||
])('should check the latest java version for %s and resolve locally', async (input, expected) => {
|
||||
mockJavaBase = new EmptyJavaBase(input);
|
||||
mockJavaBase['findInToolcache'] = () => ({ version: '11.0.9', path: expected.path });
|
||||
await expect(mockJavaBase.setupJava()).resolves.toEqual(expected);
|
||||
expect(spyCoreInfo).toHaveBeenCalledWith('Trying to resolve the latest version from remote');
|
||||
expect(spyCoreInfo).toHaveBeenCalledWith(`Resolved latest version as ${expected.version}`);
|
||||
expect(spyCoreInfo).toHaveBeenCalledWith(`Resolved Java ${expected.version} from tool-cache`);
|
||||
expect(spyCoreInfo).toHaveBeenCalledWith(`Setting Java ${expected.version} as the default`);
|
||||
});
|
||||
|
||||
it.each([
|
||||
[
|
||||
{ version: '11', architecture: 'x86', packageType: 'jdk', checkLatest: true },
|
||||
{ version: actualJavaVersion, path: javaPathInstalled }
|
||||
],
|
||||
[
|
||||
{ version: '11.0', architecture: 'x86', packageType: 'jdk', checkLatest: true },
|
||||
{ version: actualJavaVersion, path: javaPathInstalled }
|
||||
],
|
||||
[
|
||||
{ version: '11.0.x', architecture: 'x86', packageType: 'jdk', checkLatest: true },
|
||||
{ version: actualJavaVersion, path: javaPathInstalled }
|
||||
]
|
||||
])('should check the latest java version for %s and download', async (input, expected) => {
|
||||
mockJavaBase = new EmptyJavaBase(input);
|
||||
await expect(mockJavaBase.setupJava()).resolves.toEqual(expected);
|
||||
expect(spyGetToolcachePath).toHaveBeenCalled();
|
||||
expect(spyCoreInfo).toHaveBeenCalledWith('Trying to resolve the latest version from remote');
|
||||
expect(spyCoreInfo).toHaveBeenCalledWith(`Resolved latest version as ${actualJavaVersion}`);
|
||||
expect(spyCoreInfo).toHaveBeenCalledWith('Trying to download...');
|
||||
expect(spyCoreInfo).toHaveBeenCalledWith(`Java ${actualJavaVersion} was downloaded`);
|
||||
expect(spyCoreInfo).toHaveBeenCalledWith(`Setting Java ${expected.version} as the default`);
|
||||
});
|
||||
|
||||
it.each([
|
||||
[{ version: '15', architecture: 'x86', packageType: 'jre', checkLatest: false }],
|
||||
[{ version: '11.0.7', architecture: 'x64', packageType: 'jre', checkLatest: false }]
|
||||
])('should throw an error for Available version not found for %s', async input => {
|
||||
mockJavaBase = new EmptyJavaBase(input);
|
||||
await expect(mockJavaBase.setupJava()).rejects.toThrowError('Available version not found');
|
||||
|
|
|
@ -93,7 +93,12 @@ describe('setupJava', () => {
|
|||
});
|
||||
|
||||
it('java is resolved from toolcache, jdkfile is untouched', async () => {
|
||||
const inputs = { version: actualJavaVersion, architecture: 'x86', packageType: 'jdk' };
|
||||
const inputs = {
|
||||
version: actualJavaVersion,
|
||||
architecture: 'x86',
|
||||
packageType: 'jdk',
|
||||
checkLatest: false
|
||||
};
|
||||
const jdkFile = 'not_existing_one';
|
||||
const expected = {
|
||||
version: actualJavaVersion,
|
||||
|
@ -110,7 +115,12 @@ describe('setupJava', () => {
|
|||
});
|
||||
|
||||
it("java is resolved from toolcache, jdkfile doesn't exist", async () => {
|
||||
const inputs = { version: actualJavaVersion, architecture: 'x86', packageType: 'jdk' };
|
||||
const inputs = {
|
||||
version: actualJavaVersion,
|
||||
architecture: 'x86',
|
||||
packageType: 'jdk',
|
||||
checkLatest: false
|
||||
};
|
||||
const jdkFile = undefined;
|
||||
const expected = {
|
||||
version: actualJavaVersion,
|
||||
|
@ -127,7 +137,12 @@ describe('setupJava', () => {
|
|||
});
|
||||
|
||||
it('java is unpacked from jdkfile', async () => {
|
||||
const inputs = { version: '11.0.289', architecture: 'x86', packageType: 'jdk' };
|
||||
const inputs = {
|
||||
version: '11.0.289',
|
||||
architecture: 'x86',
|
||||
packageType: 'jdk',
|
||||
checkLatest: false
|
||||
};
|
||||
const jdkFile = expectedJdkFile;
|
||||
const expected = {
|
||||
version: '11.0.289',
|
||||
|
@ -147,7 +162,12 @@ describe('setupJava', () => {
|
|||
});
|
||||
|
||||
it('jdk file is not found', async () => {
|
||||
const inputs = { version: '11.0.289', architecture: 'x86', packageType: 'jdk' };
|
||||
const inputs = {
|
||||
version: '11.0.289',
|
||||
architecture: 'x86',
|
||||
packageType: 'jdk',
|
||||
checkLatest: false
|
||||
};
|
||||
const jdkFile = 'not_existing_one';
|
||||
const expected = {
|
||||
javaVersion: '11.0.289',
|
||||
|
@ -170,10 +190,22 @@ describe('setupJava', () => {
|
|||
});
|
||||
|
||||
it.each([
|
||||
[{ version: '8.0.289', architecture: 'x64', packageType: 'jdk' }, 'otherJdkFile'],
|
||||
[{ version: '11.0.289', architecture: 'x64', packageType: 'jdk' }, 'otherJdkFile'],
|
||||
[{ version: '12.0.289', architecture: 'x64', packageType: 'jdk' }, 'otherJdkFile'],
|
||||
[{ version: '11.1.11', architecture: 'x64', packageType: 'jdk' }, 'not_existing_one']
|
||||
[
|
||||
{ version: '8.0.289', architecture: 'x64', packageType: 'jdk', checkLatest: false },
|
||||
'otherJdkFile'
|
||||
],
|
||||
[
|
||||
{ version: '11.0.289', architecture: 'x64', packageType: 'jdk', checkLatest: false },
|
||||
'otherJdkFile'
|
||||
],
|
||||
[
|
||||
{ version: '12.0.289', architecture: 'x64', packageType: 'jdk', checkLatest: false },
|
||||
'otherJdkFile'
|
||||
],
|
||||
[
|
||||
{ version: '11.1.11', architecture: 'x64', packageType: 'jdk', checkLatest: false },
|
||||
'not_existing_one'
|
||||
]
|
||||
])(
|
||||
`Throw an error if jdkfile has wrong path, inputs %s, jdkfile %s, real name ${expectedJdkFile}`,
|
||||
async (inputs, jdkFile) => {
|
||||
|
@ -186,9 +218,15 @@ describe('setupJava', () => {
|
|||
);
|
||||
|
||||
it.each([
|
||||
[{ version: '8.0.289', architecture: 'x64', packageType: 'jdk' }, ''],
|
||||
[{ version: '7.0.289', architecture: 'x64', packageType: 'jdk' }, undefined],
|
||||
[{ version: '11.0.289', architecture: 'x64', packageType: 'jdk' }, undefined]
|
||||
[{ version: '8.0.289', architecture: 'x64', packageType: 'jdk', checkLatest: false }, ''],
|
||||
[
|
||||
{ version: '7.0.289', architecture: 'x64', packageType: 'jdk', checkLatest: false },
|
||||
undefined
|
||||
],
|
||||
[
|
||||
{ version: '11.0.289', architecture: 'x64', packageType: 'jdk', checkLatest: false },
|
||||
undefined
|
||||
]
|
||||
])('Throw an error if jdkfile is not specified, inputs %s', async (inputs, jdkFile) => {
|
||||
mockJavaBase = new LocalDistribution(inputs, jdkFile);
|
||||
await expect(mockJavaBase.setupJava()).rejects.toThrowError("'jdkFile' is not specified");
|
||||
|
|
|
@ -30,27 +30,27 @@ describe('getAvailableVersions', () => {
|
|||
|
||||
it.each([
|
||||
[
|
||||
{ version: '11', architecture: 'x86', packageType: 'jdk' },
|
||||
{ version: '11', architecture: 'x86', packageType: 'jdk', checkLatest: false },
|
||||
'?os=macos&ext=tar.gz&bundle_type=jdk&javafx=false&arch=x86&hw_bitness=32&release_status=ga'
|
||||
],
|
||||
[
|
||||
{ version: '11-ea', architecture: 'x86', packageType: 'jdk' },
|
||||
{ version: '11-ea', architecture: 'x86', packageType: 'jdk', checkLatest: false },
|
||||
'?os=macos&ext=tar.gz&bundle_type=jdk&javafx=false&arch=x86&hw_bitness=32&release_status=ea'
|
||||
],
|
||||
[
|
||||
{ version: '8', architecture: 'x64', packageType: 'jdk' },
|
||||
{ version: '8', architecture: 'x64', packageType: 'jdk', checkLatest: false },
|
||||
'?os=macos&ext=tar.gz&bundle_type=jdk&javafx=false&arch=x86&hw_bitness=64&release_status=ga'
|
||||
],
|
||||
[
|
||||
{ version: '8', architecture: 'x64', packageType: 'jre' },
|
||||
{ version: '8', architecture: 'x64', packageType: 'jre', checkLatest: false },
|
||||
'?os=macos&ext=tar.gz&bundle_type=jre&javafx=false&arch=x86&hw_bitness=64&release_status=ga'
|
||||
],
|
||||
[
|
||||
{ version: '8', architecture: 'x64', packageType: 'jdk+fx' },
|
||||
{ version: '8', architecture: 'x64', packageType: 'jdk+fx', checkLatest: false },
|
||||
'?os=macos&ext=tar.gz&bundle_type=jdk&javafx=true&arch=x86&hw_bitness=64&release_status=ga&features=fx'
|
||||
],
|
||||
[
|
||||
{ version: '8', architecture: 'x64', packageType: 'jre+fx' },
|
||||
{ version: '8', architecture: 'x64', packageType: 'jre+fx', checkLatest: false },
|
||||
'?os=macos&ext=tar.gz&bundle_type=jre&javafx=true&arch=x86&hw_bitness=64&release_status=ga&features=fx'
|
||||
]
|
||||
])('build correct url for %s -> %s', async (input, parsedUrl) => {
|
||||
|
@ -68,7 +68,8 @@ describe('getAvailableVersions', () => {
|
|||
const distribution = new ZuluDistribution({
|
||||
version: '11',
|
||||
architecture: 'x86',
|
||||
packageType: 'jdk'
|
||||
packageType: 'jdk',
|
||||
checkLatest: false
|
||||
});
|
||||
const availableVersions = await distribution['getAvailableVersions']();
|
||||
expect(availableVersions).toHaveLength(manifestData.length);
|
||||
|
@ -85,7 +86,8 @@ describe('getArchitectureOptions', () => {
|
|||
const distribution = new ZuluDistribution({
|
||||
version: '11',
|
||||
architecture: input.architecture,
|
||||
packageType: 'jdk'
|
||||
packageType: 'jdk',
|
||||
checkLatest: false
|
||||
});
|
||||
expect(distribution['getArchitectureOptions']()).toEqual(expected);
|
||||
});
|
||||
|
@ -108,7 +110,8 @@ describe('findPackageForDownload', () => {
|
|||
const distribution = new ZuluDistribution({
|
||||
version: input,
|
||||
architecture: 'x86',
|
||||
packageType: 'jdk'
|
||||
packageType: 'jdk',
|
||||
checkLatest: false
|
||||
});
|
||||
distribution['getAvailableVersions'] = async () => manifestData;
|
||||
const result = await distribution['findPackageForDownload'](distribution['version']);
|
||||
|
@ -119,7 +122,8 @@ describe('findPackageForDownload', () => {
|
|||
const distribution = new ZuluDistribution({
|
||||
version: '',
|
||||
architecture: 'x86',
|
||||
packageType: 'jdk'
|
||||
packageType: 'jdk',
|
||||
checkLatest: false
|
||||
});
|
||||
distribution['getAvailableVersions'] = async () => manifestData;
|
||||
const result = await distribution['findPackageForDownload']('11.0.5');
|
||||
|
@ -132,7 +136,8 @@ describe('findPackageForDownload', () => {
|
|||
const distribution = new ZuluDistribution({
|
||||
version: '18',
|
||||
architecture: 'x86',
|
||||
packageType: 'jdk'
|
||||
packageType: 'jdk',
|
||||
checkLatest: false
|
||||
});
|
||||
await expect(
|
||||
distribution['findPackageForDownload'](distribution['version'])
|
||||
|
@ -151,7 +156,8 @@ describe('convertVersionToSemver', () => {
|
|||
const distribution = new ZuluDistribution({
|
||||
version: '18',
|
||||
architecture: 'x86',
|
||||
packageType: 'jdk'
|
||||
packageType: 'jdk',
|
||||
checkLatest: false
|
||||
});
|
||||
const actual = distribution['convertVersionToSemver'](input);
|
||||
expect(actual).toBe(expected);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue