|
|
@ -1,7 +1,7 @@ |
|
|
|
import { |
|
|
|
import { |
|
|
|
basename, extname, isObject, stripTags, parseIssueHref, |
|
|
|
basename, extname, isObject, stripTags, parseIssueHref, |
|
|
|
parseUrl, translateMonth, translateDay, blobToDataURI, |
|
|
|
parseUrl, translateMonth, translateDay, blobToDataURI, |
|
|
|
toAbsoluteUrl, encodeURLEncodedBase64, decodeURLEncodedBase64, isImageFile, isVideoFile, parseIssueNewHref, |
|
|
|
toAbsoluteUrl, encodeURLEncodedBase64, decodeURLEncodedBase64, isImageFile, isVideoFile, parseRepoOwnerPathInfo, |
|
|
|
} from './utils.ts'; |
|
|
|
} from './utils.ts'; |
|
|
|
|
|
|
|
|
|
|
|
test('basename', () => { |
|
|
|
test('basename', () => { |
|
|
@ -45,12 +45,14 @@ test('parseIssueHref', () => { |
|
|
|
expect(parseIssueHref('')).toEqual({ownerName: undefined, repoName: undefined, type: undefined, index: undefined}); |
|
|
|
expect(parseIssueHref('')).toEqual({ownerName: undefined, repoName: undefined, type: undefined, index: undefined}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
test('parseIssueNewHref', () => { |
|
|
|
test('parseRepoOwnerPathInfo', () => { |
|
|
|
expect(parseIssueNewHref('/owner/repo/issues/new')).toEqual({ownerName: 'owner', repoName: 'repo', pathType: 'issues'}); |
|
|
|
expect(parseRepoOwnerPathInfo('/owner/repo/issues/new')).toEqual({ownerName: 'owner', repoName: 'repo'}); |
|
|
|
expect(parseIssueNewHref('/owner/repo/issues/new?query')).toEqual({ownerName: 'owner', repoName: 'repo', pathType: 'issues'}); |
|
|
|
expect(parseRepoOwnerPathInfo('/owner/repo/releases')).toEqual({ownerName: 'owner', repoName: 'repo'}); |
|
|
|
expect(parseIssueNewHref('/sub/owner/repo/issues/new#hash')).toEqual({ownerName: 'owner', repoName: 'repo', pathType: 'issues'}); |
|
|
|
expect(parseRepoOwnerPathInfo('/other')).toEqual({}); |
|
|
|
expect(parseIssueNewHref('/sub/owner/repo/compare/feature/branch-1...fix/branch-2')).toEqual({ownerName: 'owner', repoName: 'repo', pathType: 'pulls'}); |
|
|
|
window.config.appSubUrl = '/sub'; |
|
|
|
expect(parseIssueNewHref('/other')).toEqual({}); |
|
|
|
expect(parseRepoOwnerPathInfo('/sub/owner/repo/issues/new')).toEqual({ownerName: 'owner', repoName: 'repo'}); |
|
|
|
|
|
|
|
expect(parseRepoOwnerPathInfo('/sub/owner/repo/compare/feature/branch-1...fix/branch-2')).toEqual({ownerName: 'owner', repoName: 'repo'}); |
|
|
|
|
|
|
|
window.config.appSubUrl = ''; |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
test('parseUrl', () => { |
|
|
|
test('parseUrl', () => { |
|
|
|