Improve dependencies cache usage

This commit is contained in:
Gustavo Bastos 2022-08-12 12:42:43 +02:00
parent 5b36705a13
commit 2d1721088f
6 changed files with 79 additions and 8 deletions

View file

@ -92,6 +92,18 @@ describe('dependency cache', () => {
expect(spyWarning).not.toBeCalled();
expect(spyInfo).toBeCalledWith('maven cache is not found');
});
it('downloads cache with a custom key prefix', async () => {
createFile(join(workspace, 'pom.xml'));
await restore('maven', 'YYYY-MM');
expect(spyCacheRestore).toBeCalledWith(
[expect.stringContaining('/.m2/repository')],
expect.stringContaining('setup-java-YYYY-MM-macOS-maven-'),
['setup-java-YYYY-MM-macOS-maven-', 'setup-java-YYYY-MM-macOS-', 'setup-java-YYYY-MM-']
);
expect(spyWarning).not.toBeCalled();
expect(spyInfo).toBeCalledWith('maven cache is not found');
});
});
describe('for gradle', () => {
it('throws error if no build.gradle found', async () => {