@@ -461,4 +461,22 @@ describe("pending PR scenario detection", () => {
461461 expect ( records . pullRequestChecks ) . toHaveLength ( 0 ) ;
462462 vi . restoreAllMocks ( ) ;
463463 } ) ;
464+
465+ // #8329: exercise both branches of sameLogin's `value &&` short-circuit and the case-insensitive matching of
466+ // sameRepoFullName/sameLogin — a ghost/deleted account (null/undefined authorLogin) must be excluded, while a
467+ // repoFullName or login that differs only in letter case must still match.
468+ it ( "excludes null/undefined authorLogin and matches case-insensitively on repo and login" , async ( ) => {
469+ const env = { } as Env ;
470+ vi . spyOn ( repositories , "listPullRequestReviews" ) . mockImplementation ( async ( _env , _repo , pullNumber ) => [ approvedReview ( pullNumber ) ] ) ;
471+ vi . spyOn ( repositories , "listCheckSummaries" ) . mockResolvedValue ( [ ] ) ;
472+ const records = await loadContributorRepoOpenPrSignalRecords ( env , "entrius/allways-ui" , "miner-a" , [
473+ pr ( { number : 80 , authorLogin : null } ) , // ghost account → sameLogin short-circuits to excluded
474+ pr ( { number : 81 , authorLogin : undefined } ) , // deleted account → excluded
475+ pr ( { number : 82 , repoFullName : "Entrius/Allways-UI" } ) , // repo differs only in case → still matches
476+ pr ( { number : 83 , authorLogin : "Miner-A" } ) , // login differs only in case → still matches
477+ ] ) ;
478+ // Only the two case-differing (but genuinely matching) PRs are counted; both ghost-account PRs are excluded.
479+ expect ( records . pullRequestReviews . map ( ( review ) => review . pullNumber ) . sort ( ( a , b ) => a - b ) ) . toEqual ( [ 82 , 83 ] ) ;
480+ vi . restoreAllMocks ( ) ;
481+ } ) ;
464482} ) ;
0 commit comments