argo-cd

Форк
0
52 строки · 2.2 Кб
1
import {repoUrl, revisionUrl} from './urls';
2

3
function testExample(http: string, ssl: string, revision: string, expectedRepoUrl: string, expectedRevisionUrl: string) {
4
    expect(repoUrl(http)).toBe(expectedRepoUrl);
5
    expect(repoUrl(ssl)).toBe(expectedRepoUrl);
6
    expect(revisionUrl(http, revision)).toBe(expectedRevisionUrl);
7
    expect(revisionUrl(ssl, revision)).toBe(expectedRevisionUrl);
8
    expect(repoUrl(http)).toBe(expectedRepoUrl);
9
    expect(revisionUrl(http, revision)).toBe(expectedRevisionUrl);
10
    expect(revisionUrl(ssl, revision)).toBe(expectedRevisionUrl);
11
}
12

13
test('github.com', () => {
14
    testExample(
15
        'https://github.com/argoproj/argo-cd.git',
16
        'git@github.com:argoproj/argo-cd.git',
17
        '024dee09f543ce7bb5af7ca50260504d89dfda94',
18
        'https://github.com/argoproj/argo-cd',
19
        'https://github.com/argoproj/argo-cd/commit/024dee09f543ce7bb5af7ca50260504d89dfda94');
20
});
21

22
// for enterprise github installations
23
test('github.my-enterprise.com', () => {
24
    testExample(
25
        'https://github.my-enterprise.com/my-org/my-repo.git',
26
        'git@github.my-enterprise.com:my-org/my-repo.git',
27
        'a06f2be80a4da89abb8ced904beab75b3ec6db0e',
28
        'https://github.my-enterprise.com/my-org/my-repo',
29
        'https://github.my-enterprise.com/my-org/my-repo/commit/a06f2be80a4da89abb8ced904beab75b3ec6db0e');
30
});
31

32
test('gitlab.com', () => {
33
    testExample(
34
        'https://gitlab.com/alex_collins/private-repo.git',
35
        'git@gitlab.com:alex_collins/private-repo.git',
36
        'b1fe9426ead684d7af16958920968342ee295c1f',
37
        'https://gitlab.com/alex_collins/private-repo',
38
        'https://gitlab.com/alex_collins/private-repo/-/commit/b1fe9426ead684d7af16958920968342ee295c1f');
39
});
40

41
test('bitbucket.org', () => {
42
    testExample(
43
        'https://alexcollinsinuit@bitbucket.org/alexcollinsinuit/test-repo.git',
44
        'git@bitbucket.org:alexcollinsinuit/test-repo.git',
45
        '38fb93957deb45ff546af13399a92ac0d568c350',
46
        'https://bitbucket.org/alexcollinsinuit/test-repo',
47
        'https://bitbucket.org/alexcollinsinuit/test-repo/commits/38fb93957deb45ff546af13399a92ac0d568c350');
48
});
49

50
test('empty url', () => {
51
    expect(repoUrl('')).toBe(null);
52
});
53

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.