|
1 | 1 | import {
|
2 | 2 | basename, extname, isObject, stripTags, parseIssueHref,
|
3 | 3 | parseUrl, translateMonth, translateDay, blobToDataURI,
|
4 |
| - toAbsoluteUrl, encodeURLEncodedBase64, decodeURLEncodedBase64, isImageFile, isVideoFile, parseIssueNewHref, |
| 4 | + toAbsoluteUrl, encodeURLEncodedBase64, decodeURLEncodedBase64, isImageFile, isVideoFile, parseRepoOwnerPathInfo, |
5 | 5 | } from './utils.ts';
|
6 | 6 |
|
7 | 7 | test('basename', () => {
|
@@ -45,12 +45,14 @@ test('parseIssueHref', () => {
|
45 | 45 | expect(parseIssueHref('')).toEqual({ownerName: undefined, repoName: undefined, type: undefined, index: undefined});
|
46 | 46 | });
|
47 | 47 |
|
48 |
| -test('parseIssueNewHref', () => { |
49 |
| - expect(parseIssueNewHref('/owner/repo/issues/new')).toEqual({ownerName: 'owner', repoName: 'repo', pathType: 'issues'}); |
50 |
| - expect(parseIssueNewHref('/owner/repo/issues/new?query')).toEqual({ownerName: 'owner', repoName: 'repo', pathType: 'issues'}); |
51 |
| - expect(parseIssueNewHref('/sub/owner/repo/issues/new#hash')).toEqual({ownerName: 'owner', repoName: 'repo', pathType: 'issues'}); |
52 |
| - expect(parseIssueNewHref('/sub/owner/repo/compare/feature/branch-1...fix/branch-2')).toEqual({ownerName: 'owner', repoName: 'repo', pathType: 'pulls'}); |
53 |
| - expect(parseIssueNewHref('/other')).toEqual({}); |
| 48 | +test('parseRepoOwnerPathInfo', () => { |
| 49 | + expect(parseRepoOwnerPathInfo('/owner/repo/issues/new')).toEqual({ownerName: 'owner', repoName: 'repo'}); |
| 50 | + expect(parseRepoOwnerPathInfo('/owner/repo/releases')).toEqual({ownerName: 'owner', repoName: 'repo'}); |
| 51 | + expect(parseRepoOwnerPathInfo('/other')).toEqual({}); |
| 52 | + window.config.appSubUrl = '/sub'; |
| 53 | + expect(parseRepoOwnerPathInfo('/sub/owner/repo/issues/new')).toEqual({ownerName: 'owner', repoName: 'repo'}); |
| 54 | + expect(parseRepoOwnerPathInfo('/sub/owner/repo/compare/feature/branch-1...fix/branch-2')).toEqual({ownerName: 'owner', repoName: 'repo'}); |
| 55 | + window.config.appSubUrl = ''; |
54 | 56 | });
|
55 | 57 |
|
56 | 58 | test('parseUrl', () => {
|
|
0 commit comments