mirror of
https://github.com/actions/setup-java.git
synced 2025-04-22 10:56:45 +00:00
resolve comment for check-latest
This commit is contained in:
parent
61c3e48d26
commit
6e6487b787
7 changed files with 105 additions and 52 deletions
|
@ -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");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue