mirror of
https://github.com/actions/setup-java.git
synced 2025-06-28 20:14:14 +00:00
chore: Add test for the latest known sdkman java versions
This commit is contained in:
parent
aa2ee0a475
commit
b617cc9aa7
2 changed files with 158 additions and 0 deletions
|
@ -1,5 +1,7 @@
|
|||
import * as cache from '@actions/cache';
|
||||
import * as core from '@actions/core';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import {
|
||||
convertVersionToSemver,
|
||||
getVersionFromFileContent,
|
||||
|
@ -96,6 +98,27 @@ describe('getVersionFromFileContent', () => {
|
|||
const actual = getVersionFromFileContent(content, 'openjdk', '.sdkmanrc');
|
||||
expect(actual).toBe(expected);
|
||||
});
|
||||
|
||||
describe('known versions', () => {
|
||||
const csv = fs.readFileSync(
|
||||
path.join(__dirname, 'data/sdkman-java-versions.csv'),
|
||||
'utf8'
|
||||
);
|
||||
const versions = csv.split('\n').map(r => r.split(', '));
|
||||
|
||||
it.each(versions)(
|
||||
'parsing %s should return %s',
|
||||
(sdkmanJavaVersion: string, expected: string) => {
|
||||
const asContent = `java=${sdkmanJavaVersion}`;
|
||||
const actual = getVersionFromFileContent(
|
||||
asContent,
|
||||
'openjdk',
|
||||
'.sdkmanrc'
|
||||
);
|
||||
expect(actual).toBe(expected);
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue