Fix fallback to latest version in tools.ts

This commit is contained in:
Shivam Mathur
2025-11-25 17:27:09 +05:30
parent 3961404d06
commit 91d37511e3
3 changed files with 15 additions and 2 deletions

View File

@ -244,6 +244,19 @@ describe('Tools tests', () => {
}
);
it('checking getUrl handles undefined version without double slash', async () => {
const data = getData({
tool: 'cs2pr',
repository: 'staabm/annotate-pull-request-from-checkstyle',
domain: 'https://github.com'
});
data['extension'] = '';
delete data['version'];
expect(await tools.getUrl(data)).toBe(
'https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/download/cs2pr'
);
});
it.each`
version | version_prefix | url
${'latest'} | ${''} | ${'https://example.com/tool.phar'}