@@ -21,3 +21,35 @@ it("recognizes typed GitHub references while refusing lookalike hosts and invali
2121 ] )
2222 expect ( parseGitHubReference ( url ) ) . toBeUndefined ( ) ;
2323} ) ;
24+
25+ it ( "claims only PR and issue links whose target the pane can show" , ( ) => {
26+ const pull = "https://github.com/block/buzz-app/pull/838" ;
27+ for ( const fragment of [ "" , "#issuecomment-123" , "#pullrequestreview-456" ] )
28+ expect ( parseGitHubReference ( `${ pull } ${ fragment } ` ) ?. url ) . toBe (
29+ `${ pull } ${ fragment } ` ,
30+ ) ;
31+ expect (
32+ parseGitHubReference ( "https://github.com/block/buzz-app/issues/12" ) ?. url ,
33+ ) . toBe ( "https://github.com/block/buzz-app/issues/12" ) ;
34+ for ( const url of [
35+ `${ pull } #discussion_r4240253516` ,
36+ `${ pull } #event-987` ,
37+ `${ pull } #partial-timeline` ,
38+ `${ pull } #issuecomment-` ,
39+ `${ pull } #pullrequestreview-abc` ,
40+ `${ pull } /files` ,
41+ `${ pull } /files#diff-0123abcd` ,
42+ `${ pull } /files#r4240253516` ,
43+ `${ pull } /files/abcdef1..0123456` ,
44+ `${ pull } /commits` ,
45+ `${ pull } /commits/abcdef1` ,
46+ `${ pull } /commits/abcdef1#r4240253516` ,
47+ `${ pull } /checks` ,
48+ `${ pull } /checks?check_run_id=1` ,
49+ `${ pull } /conflicts` ,
50+ `${ pull } /changes` ,
51+ `${ pull } /activity` ,
52+ "https://github.com/block/buzz-app/issues/12#issuecomment-123" ,
53+ ] )
54+ expect ( parseGitHubReference ( url ) , url ) . toBeUndefined ( ) ;
55+ } ) ;
0 commit comments