Files
vercel/packages/cli/test/unit/util/git/repo-info-to-url.test.ts
Nathan Rajlich 8d7206f5b6 [cli] Run local Project detection during vc link --repo (#10094)
Run local Project detection during `vc link --repo`. This allows for creation of new Projects that do not yet exist under the selected scope.
2023-07-10 22:42:13 +00:00

35 lines
1019 B
TypeScript

import { repoInfoToUrl } from '../../../../src/util/git/repo-info-to-url';
import type { RepoInfo } from '../../../../src/util/git/connect-git-provider';
describe('repoInfoToUrl()', () => {
it('should support "github" URL', () => {
const info: RepoInfo = {
provider: 'github',
org: 'vercel',
repo: 'foo',
url: 'git@github.com:vercel/foo.git',
};
expect(repoInfoToUrl(info)).toEqual('https://github.com/vercel/foo');
});
it('should support "gitlab" URL', () => {
const info: RepoInfo = {
provider: 'gitlab',
org: 'vercel',
repo: 'foo',
url: 'git@gitlab.com:vercel/foo.git',
};
expect(repoInfoToUrl(info)).toEqual('https://gitlab.com/vercel/foo');
});
it('should support "bitbucket" URL', () => {
const info: RepoInfo = {
provider: 'bitbucket',
org: 'vercel',
repo: 'foo',
url: 'git@bitbucket.com:vercel/foo.git',
};
expect(repoInfoToUrl(info)).toEqual('https://bitbucket.com/vercel/foo');
});
});