Files
Sergei Zharinov 930cf6633c refactor: Rewrite imports with .ts extensions (#40700)
fix: Additional vi.mock path corrections and prettier formatting
2026-01-26 22:48:17 +00:00

42 lines
1.2 KiB
TypeScript

import { findHandler, findHandlerByType } from './index.ts';
describe('modules/manager/homebrew/handlers/index', () => {
describe('findHandlerByType', () => {
it.each(['unknown', ''])('returns null for handler type "%s"', (type) => {
expect(findHandlerByType(type)).toBeNull();
});
it('returns github handler for github type', () => {
const handler = findHandlerByType('github');
expect(handler).toMatchObject({ type: 'github' });
});
});
describe('findHandler', () => {
it('returns null for null URL', () => {
expect(findHandler(null)).toBeNull();
});
it('returns null for unsupported URL', () => {
expect(findHandler('https://example.com/file.tar.gz')).toBeNull();
});
it('returns handler and parsed result for GitHub URL', () => {
const result = findHandler(
'https://github.com/aide/aide/releases/download/v0.16.1/aide-0.16.1.tar.gz',
);
expect(result).toMatchObject({
handler: { type: 'github' },
parsed: {
type: 'github',
currentValue: 'v0.16.1',
ownerName: 'aide',
repoName: 'aide',
urlType: 'releases',
},
});
});
});
});