@@ -3,9 +3,17 @@ import { Script, createContext } from "node:vm";
33import { describe , expect , it , vi } from "vitest" ;
44
55const contentScript = readFileSync ( "apps/loopover-extension/content.js" , "utf8" ) ;
6+ const manifest = JSON . parse ( readFileSync ( "apps/loopover-extension/manifest.json" , "utf8" ) ) as {
7+ content_scripts : Array < { matches : string [ ] } > ;
8+ } ;
69
710describe ( "extension content script" , ( ) => {
8- it ( "detects GitHub pull request and issue routes while only mounting pull overlays" , ( ) => {
11+ it ( "declares content-script matches for pull pages only (#7462)" , ( ) => {
12+ expect ( manifest . content_scripts [ 0 ] ?. matches ) . toEqual ( [ "https://github.com/*/*/pull/*" ] ) ;
13+ expect ( manifest . content_scripts [ 0 ] ?. matches . join ( "\n" ) ) . not . toContain ( "issues" ) ;
14+ } ) ;
15+
16+ it ( "detects GitHub pull request routes and treats issue pages as out of scope" , ( ) => {
917 const internals = loadContentInternals ( ) ;
1018
1119 expect ( internals . matchGitHubPageTarget ( "/JSONbored/loopover/pull/146" ) ) . toEqual ( {
@@ -14,12 +22,8 @@ describe("extension content script", () => {
1422 repo : "loopover" ,
1523 pullNumber : 146 ,
1624 } ) ;
17- expect ( internals . matchGitHubPageTarget ( "/JSONbored/loopover/issues/145" ) ) . toEqual ( {
18- kind : "issue" ,
19- owner : "JSONbored" ,
20- repo : "loopover" ,
21- issueNumber : 145 ,
22- } ) ;
25+ // Issue pages are out of scope — no kind:"issue" classification, and no match.
26+ expect ( internals . matchGitHubPageTarget ( "/JSONbored/loopover/issues/145" ) ) . toBeNull ( ) ;
2327 expect ( internals . matchGitHubPageTarget ( "/JSONbored/loopover/pulls" ) ) . toBeNull ( ) ;
2428 expect ( internals . matchPullRequestTarget ( "/JSONbored/loopover/pull/146" ) ) . toEqual ( {
2529 owner : "JSONbored" ,
@@ -91,7 +95,7 @@ function loadContentInternals() {
9195 return vmContext . __loopoverContentInternals as {
9296 matchGitHubPageTarget : (
9397 pathname : string ,
94- ) => { kind : "pull_request" ; owner : string ; repo : string ; pullNumber : number } | { kind : "issue" ; owner : string ; repo : string ; issueNumber : number } | null ;
98+ ) => { kind : "pull_request" ; owner : string ; repo : string ; pullNumber : number } | null ;
9599 matchPullRequestTarget : ( pathname : string ) => { owner : string ; repo : string ; pullNumber : number } | null ;
96100 renderPullContext : ( payload : unknown ) => string ;
97101 } ;
0 commit comments