@@ -364,6 +364,38 @@ describe("DashboardPage — tab badge counts", () => {
364364 expect ( screen . getByRole ( "tab" , { name : / A c t i o n s / } ) . textContent ?. replace ( / \D + / g, "" ) ) . toBe ( "3" ) ;
365365 } ) ;
366366 } ) ;
367+
368+ it ( "filters badge counts by globalFilter repo" , async ( ) => {
369+ vi . mocked ( pollService . fetchAllData ) . mockResolvedValue ( {
370+ issues : [
371+ makeIssue ( { id : 1 , title : "Issue A" , repoFullName : "org/alpha" } ) ,
372+ makeIssue ( { id : 2 , title : "Issue B" , repoFullName : "org/beta" } ) ,
373+ makeIssue ( { id : 3 , title : "Issue C" , repoFullName : "org/alpha" } ) ,
374+ ] ,
375+ pullRequests : [
376+ makePullRequest ( { id : 10 , repoFullName : "org/alpha" } ) ,
377+ makePullRequest ( { id : 11 , repoFullName : "org/beta" } ) ,
378+ ] ,
379+ workflowRuns : [
380+ makeWorkflowRun ( { id : 20 , repoFullName : "org/alpha" } ) ,
381+ makeWorkflowRun ( { id : 21 , repoFullName : "org/beta" } ) ,
382+ makeWorkflowRun ( { id : 22 , repoFullName : "org/beta" } ) ,
383+ ] ,
384+ errors : [ ] ,
385+ } ) ;
386+ // Set filter BEFORE render to avoid Kobalte Select onChange cascade in happy-dom
387+ viewStore . updateViewState ( {
388+ hideDepDashboard : false ,
389+ globalFilter : { org : null , repo : "org/alpha" } ,
390+ } ) ;
391+
392+ render ( ( ) => < DashboardPage /> ) ;
393+ await waitFor ( ( ) => {
394+ expect ( screen . getByRole ( "tab" , { name : / I s s u e s / } ) . textContent ?. replace ( / \D + / g, "" ) ) . toBe ( "2" ) ;
395+ expect ( screen . getByRole ( "tab" , { name : / P u l l R e q u e s t s / } ) . textContent ?. replace ( / \D + / g, "" ) ) . toBe ( "1" ) ;
396+ expect ( screen . getByRole ( "tab" , { name : / A c t i o n s / } ) . textContent ?. replace ( / \D + / g, "" ) ) . toBe ( "1" ) ;
397+ } ) ;
398+ } ) ;
367399} ) ;
368400
369401describe ( "DashboardPage — data flow" , ( ) => {
0 commit comments