@@ -19,6 +19,7 @@ import {
1919 findNewOpenPullRequests ,
2020 formatDuration ,
2121 githubUrlClickActionForDetail ,
22+ groupRepositoriesByOwner ,
2223 isFailedWorkflowRun ,
2324 isPullRequestAuthor ,
2425 isLiveStatus ,
@@ -35,6 +36,24 @@ import {
3536} from "./appLogic" ;
3637
3738describe ( "appLogic" , ( ) => {
39+ it ( "groups repositories alphabetically by owner and repository name" , ( ) => {
40+ const repos = [
41+ { owner : "zeta" , name : "selected" , fullName : "zeta/selected" , updatedAt : "2026-01-01T00:00:00Z" } ,
42+ { owner : "alpha" , name : "zebra" , fullName : "alpha/zebra" , updatedAt : "2026-01-03T00:00:00Z" } ,
43+ { owner : "alpha" , name : "aardvark" , fullName : "alpha/aardvark" , updatedAt : "2026-01-02T00:00:00Z" } ,
44+ { owner : "beta" , name : "repo-10" , fullName : "beta/repo-10" , updatedAt : "2026-01-04T00:00:00Z" } ,
45+ { owner : "beta" , name : "repo-2" , fullName : "beta/repo-2" , updatedAt : "2026-01-05T00:00:00Z" }
46+ ] as RepoSummary [ ] ;
47+
48+ expect (
49+ groupRepositoriesByOwner ( repos ) . map ( ( [ owner , ownerRepos ] ) => [ owner , ownerRepos . map ( ( repo ) => repo . name ) ] )
50+ ) . toEqual ( [
51+ [ "alpha" , [ "aardvark" , "zebra" ] ] ,
52+ [ "beta" , [ "repo-2" , "repo-10" ] ] ,
53+ [ "zeta" , [ "selected" ] ]
54+ ] ) ;
55+ } ) ;
56+
3857 it ( "formats durations for workflow runs" , ( ) => {
3958 expect ( formatDuration ( null ) ) . toBe ( "" ) ;
4059 expect ( formatDuration ( 9_800 ) ) . toBe ( "9s" ) ;
0 commit comments