Tests and pathing

This commit is contained in:
Danny McCormick 2019-07-15 14:46:34 -04:00
parent 02c1a8e374
commit 72c20b3e34
3 changed files with 41 additions and 3 deletions

View file

@ -51,7 +51,7 @@ describe('installer tests', () => {
}
}, 100000);
it('Acquires version of Java if no matching version is installed', async () => {
it('Installs version of Java from jdkFile if no matching version is installed', async () => {
await installer.getJava('12', 'x64', javaFilePath);
const JavaDir = path.join(toolDir, 'Java', '12.0.0', 'x64');
@ -69,6 +69,24 @@ describe('installer tests', () => {
expect(thrown).toBe(true);
});
it('Downloads java if no file given', async () => {
await installer.getJava('8.0.102', 'x64', '');
const JavaDir = path.join(toolDir, 'Java', '8.0.102', 'x64');
expect(fs.existsSync(`${JavaDir}.complete`)).toBe(true);
expect(fs.existsSync(path.join(JavaDir, 'bin'))).toBe(true);
}, 100000);
it('Throws if invalid directory to jdk', async () => {
let thrown = false;
try {
await installer.getJava('1000', 'x64', 'bad path');
} catch {
thrown = true;
}
expect(thrown).toBe(true);
});
it('Uses version of Java installed in cache', async () => {
const JavaDir: string = path.join(toolDir, 'Java', '250.0.0', 'x64');
await io.mkdirP(JavaDir);