0
0
mirror of https://github.com/renovatebot/renovate.git synced 2024-12-22 13:38:32 +00:00
renovatebot_renovate/lib/modules/manager/puppet/common.spec.ts
2023-11-07 15:50:29 +00:00

45 lines
1.3 KiB
TypeScript

import {
RE_REPOSITORY_GENERIC_GIT_SSH_FORMAT,
parseGitOwnerRepo,
} from './common';
describe('modules/manager/puppet/common', () => {
describe('RE_REPOSITORY_GENERIC_GIT_SSH_FORMAT', () => {
it('access by index', () => {
const regex = RE_REPOSITORY_GENERIC_GIT_SSH_FORMAT.exec(
'git@gitlab.com:dir1/dir2/project.git',
);
expect(regex).not.toBeNull();
expect(String(regex)).toBe(
'git@gitlab.com:dir1/dir2/project.git,dir1/dir2/project.git',
);
});
it('access by named group', () => {
const regex = RE_REPOSITORY_GENERIC_GIT_SSH_FORMAT.exec(
'git@gitlab.com:dir1/dir2/project.git',
);
expect(regex).not.toBeNull();
expect(String(regex)).toBe(
'git@gitlab.com:dir1/dir2/project.git,dir1/dir2/project.git',
);
expect(regex?.groups).not.toBeNull();
expect(regex?.groups?.repository).toBe('dir1/dir2/project.git');
});
});
describe('parseGitOwnerRepo', () => {
it('unable to parse url', () => {
expect(parseGitOwnerRepo('invalid-url-example', false)).toBeNull();
});
it('parseable url', () => {
const url = parseGitOwnerRepo(
'https://gitlab.com/example/example',
false,
);
expect(url).toBe('example/example');
});
});
});