mirror of
https://github.com/actions/setup-java.git
synced 2025-04-19 09:26:46 +00:00
feat: add check for the package type, update unit tests
This commit is contained in:
parent
8036ba5657
commit
2c43893557
3 changed files with 24 additions and 0 deletions
|
@ -206,5 +206,22 @@ describe('getAvailableVersions', () => {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
it('should throw when required package type is not jdk', async () => {
|
||||||
|
const jdkVersion = '17';
|
||||||
|
const arch = 'x64';
|
||||||
|
const platform = 'linux';
|
||||||
|
const distribution = new DragonwellDistribution({
|
||||||
|
version: jdkVersion,
|
||||||
|
architecture: arch,
|
||||||
|
packageType: 'jre',
|
||||||
|
checkLatest: false
|
||||||
|
});
|
||||||
|
mockPlatform(distribution, platform);
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
distribution['findPackageForDownload'](jdkVersion)
|
||||||
|
).rejects.toThrow('Dragonwell provides only the `jdk` package type');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
3
dist/setup/index.js
vendored
3
dist/setup/index.js
vendored
|
@ -102658,6 +102658,9 @@ class DragonwellDistribution extends base_installer_1.JavaBase {
|
||||||
if (!this.stable) {
|
if (!this.stable) {
|
||||||
throw new Error('Early access versions are not supported');
|
throw new Error('Early access versions are not supported');
|
||||||
}
|
}
|
||||||
|
if (this.packageType !== 'jdk') {
|
||||||
|
throw new Error('Dragonwell provides only the `jdk` package type');
|
||||||
|
}
|
||||||
const availableVersions = yield this.getAvailableVersions();
|
const availableVersions = yield this.getAvailableVersions();
|
||||||
const matchedVersions = availableVersions
|
const matchedVersions = availableVersions
|
||||||
.filter(item => {
|
.filter(item => {
|
||||||
|
|
|
@ -30,6 +30,10 @@ export class DragonwellDistribution extends JavaBase {
|
||||||
throw new Error('Early access versions are not supported');
|
throw new Error('Early access versions are not supported');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.packageType !== 'jdk') {
|
||||||
|
throw new Error('Dragonwell provides only the `jdk` package type');
|
||||||
|
}
|
||||||
|
|
||||||
const availableVersions = await this.getAvailableVersions();
|
const availableVersions = await this.getAvailableVersions();
|
||||||
|
|
||||||
const matchedVersions = availableVersions
|
const matchedVersions = availableVersions
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue