Add functionality to setup maven binary

Add functionality to setup maven in order to use for
project building
This commit is contained in:
Pavel Gonchukov 2021-02-22 21:36:35 +01:00
parent 104660f1cc
commit c45a722262
No known key found for this signature in database
GPG key ID: AA78DD4317B862F7
10 changed files with 150 additions and 60 deletions

View file

@ -156,4 +156,32 @@ describe('installer tests', () => {
expect(thrown).toBe(true);
return;
});
it('wrong maven version of Maven has to throw error', async () => {
let thrown = false;
try {
await installer.getMaven('2-3-4');
} catch (e) {
thrown = true;
}
expect(thrown).toBe(true);
});
it('Installs version of Maven and stores it to cache', async () => {
await installer.getMaven('3.6.3');
const mvnDir = path.join(toolDir, 'mvn', '3.6.3', 'x64');
expect(fs.existsSync(`${mvnDir}.complete`)).toBe(true);
expect(fs.existsSync(path.join(mvnDir))).toBe(true);
}, 100000);
it('Uses version of Maven installed in cache', async () => {
const mvnDir: string = path.join(toolDir, 'mvn', '3.6.3', 'x64');
console.log(mvnDir);
await io.mkdirP(mvnDir);
fs.writeFileSync(`${mvnDir}.complete`, 'hello');
// This will throw if it doesn't find it in the cache (because no such version exists)
await installer.getMaven('3.6.3');
return;
});
});