@@ -396,6 +396,36 @@ describe("DashboardPage — tab badge counts", () => {
396396 expect ( screen . getByRole ( "tab" , { name : / A c t i o n s / } ) . textContent ?. replace ( / \D + / g, "" ) ) . toBe ( "1" ) ;
397397 } ) ;
398398 } ) ;
399+
400+ it ( "filters badge counts by globalFilter org only" , async ( ) => {
401+ vi . mocked ( pollService . fetchAllData ) . mockResolvedValue ( {
402+ issues : [
403+ makeIssue ( { id : 1 , repoFullName : "alpha/one" } ) ,
404+ makeIssue ( { id : 2 , repoFullName : "beta/two" } ) ,
405+ makeIssue ( { id : 3 , repoFullName : "alpha/three" } ) ,
406+ ] ,
407+ pullRequests : [
408+ makePullRequest ( { id : 10 , repoFullName : "alpha/one" } ) ,
409+ makePullRequest ( { id : 11 , repoFullName : "beta/two" } ) ,
410+ ] ,
411+ workflowRuns : [
412+ makeWorkflowRun ( { id : 20 , repoFullName : "beta/two" } ) ,
413+ makeWorkflowRun ( { id : 21 , repoFullName : "alpha/one" } ) ,
414+ ] ,
415+ errors : [ ] ,
416+ } ) ;
417+ viewStore . updateViewState ( {
418+ hideDepDashboard : false ,
419+ globalFilter : { org : "alpha" , repo : null } ,
420+ } ) ;
421+
422+ render ( ( ) => < DashboardPage /> ) ;
423+ await waitFor ( ( ) => {
424+ expect ( screen . getByRole ( "tab" , { name : / I s s u e s / } ) . textContent ?. replace ( / \D + / g, "" ) ) . toBe ( "2" ) ;
425+ expect ( screen . getByRole ( "tab" , { name : / P u l l R e q u e s t s / } ) . textContent ?. replace ( / \D + / g, "" ) ) . toBe ( "1" ) ;
426+ expect ( screen . getByRole ( "tab" , { name : / A c t i o n s / } ) . textContent ?. replace ( / \D + / g, "" ) ) . toBe ( "1" ) ;
427+ } ) ;
428+ } ) ;
399429} ) ;
400430
401431describe ( "DashboardPage — data flow" , ( ) => {
0 commit comments