github.com/argoproj/argo-cd@v1.8.7/ui/src/app/shared/components/urls.test.ts (about) 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 42 test('bitbucket.org', () => { 43 testExample( 44 'https://alexcollinsinuit@bitbucket.org/alexcollinsinuit/test-repo.git', 45 'git@bitbucket.org:alexcollinsinuit/test-repo.git', 46 '38fb93957deb45ff546af13399a92ac0d568c350', 47 'https://bitbucket.org/alexcollinsinuit/test-repo', 48 'https://bitbucket.org/alexcollinsinuit/test-repo/commits/38fb93957deb45ff546af13399a92ac0d568c350'); 49 }); 50