36 lines
1.1 KiB
TypeScript
36 lines
1.1 KiB
TypeScript
import { getGitUrl } from '../src/utils';
|
|
|
|
describe('test getGitUrl', () => {
|
|
test('undefined', () => {
|
|
expect(getGitUrl(undefined)).toBe('');
|
|
});
|
|
|
|
test('empty url', () => {
|
|
expect(getGitUrl('')).toBe('');
|
|
});
|
|
|
|
test('url domain with branch', () => {
|
|
expect(
|
|
getGitUrl('https://gitlink.org.cn/somunslotus/material-atom-predict.git', 'master'),
|
|
).toBe('https://gitlink.org.cn/somunslotus/material-atom-predict/tree/master');
|
|
});
|
|
|
|
test('url domain without branch', () => {
|
|
expect(getGitUrl('https://gitlink.org.cn/somunslotus/material-atom-predict.git')).toBe(
|
|
'https://gitlink.org.cn/somunslotus/material-atom-predict',
|
|
);
|
|
});
|
|
|
|
test('30202 port with branch', () => {
|
|
expect(getGitUrl('http://172.20.32.235:30202/fanshuai/active_learn_demo.git', 'master')).toBe(
|
|
'http://172.20.32.235:30203/fanshuai/active_learn_demo/tree/master',
|
|
);
|
|
});
|
|
|
|
test('30202 port without branch', () => {
|
|
expect(getGitUrl('http://172.20.32.235:30202/fanshuai/active_learn_demo.git')).toBe(
|
|
'http://172.20.32.235:30203/fanshuai/active_learn_demo',
|
|
);
|
|
});
|
|
});
|