Skip to content

Commit 0d01d8e

Browse files
Copilotfregante
andauthored
Remove isRepo exception and fill test URL array with aliases
Agent-Logs-Url: https://github.com/refined-github/github-url-detection/sessions/39c59fa2-5d47-4a9a-9e3a-b15a0792b4bd Co-authored-by: fregante <1402241+fregante@users.noreply.github.com>
1 parent f2cfcff commit 0d01d8e

2 files changed

Lines changed: 40 additions & 10 deletions

File tree

index.test.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,6 @@ for (const [detectName, detect] of Object.entries(pageDetect)) {
5454
});
5555
}
5656

57-
// Skip negatives for this one, it's too long
58-
if (detectName === 'isRepo') {
59-
continue;
60-
}
61-
6257
for (const url of allUrls) {
6358
if (!validURLs.includes(url)) {
6459
test(`${detectName} NO ${url}`, () => {

index.ts

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -457,11 +457,46 @@ export const isRepo = (url: URL | HTMLAnchorElement | Location = location): bool
457457
};
458458

459459
TEST: addTests('isRepo', [
460-
// Some of these are here simply as "gotchas" to other detections
461-
'https://github.com/sindresorhus/refined-github/blame/master/package.json',
462-
'https://github.com/sindresorhus/refined-github/issues/146',
463-
'https://github.com/sindresorhus/notifications/', // Gotcha for isNotifications
464-
'https://github.com/sindresorhus/refined-github/pull/148',
460+
'isActionRun', // Includes isActionJobRun URLs
461+
'isBranches',
462+
'isCompare', // Includes isQuickPR URLs
463+
'isDeletingFile',
464+
'isEditingFile',
465+
'isEditingRelease',
466+
'isFileFinder',
467+
'isForkingRepo',
468+
'isIssue',
469+
'isLabelList',
470+
'isMilestone',
471+
'isMilestoneList',
472+
'isNewAction',
473+
'isNewFile',
474+
'isNewIssue',
475+
'isNewRelease',
476+
'isPR', // Includes isPRConversation, isPRFiles (→isPRCommit), isPRCommitList
477+
'isPRConflicts',
478+
'isProjects',
479+
'isReleases',
480+
'isRepoPRList',
481+
'isRepoCommitList',
482+
'isRepoForksList',
483+
'isRepoGitObject', // Includes isRepoTree (→isRepoRoot→isRepoHome), isSingleFile (→isRenderedTextFile), isBlame
484+
'isRepoIssueList',
485+
'isRepoNetworkGraph',
486+
'isRepoSearch',
487+
'isRepoSettings', // Includes isRepoMainSettings
488+
'isRepoTaxonomyIssueOrPRList',
489+
'isRepoWiki', // Includes isNewWikiPage, isEditingWikiPage, isCompareWikiPage
490+
'isRepositoryActions',
491+
'isSingleCommit',
492+
'isSingleReleaseOrTag',
493+
'isTags',
494+
// Repo URLs from detections that also cover non-repo pages
495+
'https://github.com/sindresorhus/refined-github/projects/3', // from isProject
496+
'https://github.com/tophf/mpiv/discussions/50', // from isDiscussion
497+
'https://github.com/withastro/roadmap/discussions/new?category=proposal', // from isNewDiscussion
498+
'https://github.com/tophf/mpiv/discussions', // from isDiscussionList
499+
// These URLs are repos but don't match any specific detection
465500
'https://github.com/sindresorhus/refined-github/milestones/new', // Gotcha for isRepoTaxonomyIssueOrPRList
466501
'https://github.com/sindresorhus/refined-github/milestones/1/edit', // Gotcha for isRepoTaxonomyIssueOrPRList
467502
'https://github.com/sindresorhus/refined-github/issues/new/choose', // Gotcha for isRepoIssueList

0 commit comments

Comments
 (0)